예제 #1
0
		void
		so_evt_start()
		{
			if( m_level != m_max_deep )
			{
				for( int i = 0; i != m_max_children; ++i )
					create_and_register_agent(
							so_environment(),
							m_self_name,
							i,
							m_max_children,
							m_level + 1,
							m_max_deep );
			}
			else
				notify_parent();
		}
예제 #2
0
int
main()
{
	try
	{
		std::set< std::string > names;

		run_with_time_limit( [&] {
			so_5::launch(
				[&]( so_5::environment_t & env )
				{
					create_and_register_agent( env, "", 0, 4, 0, 8 );
				},
				[&]( so_5::environment_params_t & params )
				{
					params.coop_listener( test_coop_listener_t::make( names ) );
				} );
			},
			240,
			"parent_child_2 test" );

		if( !names.empty() )
		{
			for( const auto & n : names )
				std::cout << "unregistered coop: '" << n << "'" << std::endl;

			throw std::runtime_error(
					"There are some not deregistered cooperations (" +
					std::to_string( names.size() ) + ")" );
		}
	}
	catch( const std::exception & ex )
	{
		std::cerr << "Error: " << ex.what() << std::endl;
		return 1;
	}

	return 0;
}
예제 #3
0
		void
		init( so_5::rt::environment_t & env )
		{
			create_and_register_agent( env, "", 0, 4, 0, 8 );
		}