Exemplo n.º 1
0
	Image
	ParallelRenderer::render (World& _world, Settings& _settings, Engine&
	    _engine, SuperSampling& _super_sampling)
	{
		TaskDispatcher task_dispatcher(_settings);
		std::vector<std::future<Tiles>> futures(0);

		for (unsigned i = 0; i < _settings.max_thread_count; i++)
		{
			// TODO can this be done better? it must be possible
			futures.push_back(std::async(std::launch::async, [this, &task_dispatcher,
			    &_world, &_settings, &_engine, &_super_sampling] () { 
					return worker(task_dispatcher, _world, _settings, _engine,
					_super_sampling); }));
		}

		for (unsigned i = 0; i < futures.size(); i++)
		{
			futures[i].wait();
		}

		Image final_image(_settings.area.size);
		for (unsigned i = 0; i < futures.size(); i++)
		{
			Tiles tiles = futures[i].get();
			for (unsigned j = 0; j < tiles.size(); j++)
			{
				final_image.paste(tiles[j].task.start, tiles[j].image);
			}
		}

		return final_image;
	}
Exemplo n.º 2
0
static void NetReceive(u8 *inpkt, int len)
{
	struct racfghdr *p_racfgh = NULL;
	unsigned char *p_tmp = inpkt;
	u16 Command_Type;

	p_racfgh = (struct racfghdr *) inpkt;
	ate_printf(MSG_INFO, "Receive Packet\n");

	if (be2cpu32/*ntohl*/(p_racfgh->magic_no) == RACFG_MAGIC_NO) {
		p_tmp = p_tmp + OFFSET_OF(struct racfghdr, comand_type);
		os_memcpy(&Command_Type, p_tmp, sizeof(Command_Type));
		Command_Type = be2cpu16(Command_Type);
		
		if ((Command_Type & RACFG_CMD_TYPE_PASSIVE_MASK) != RACFG_CMD_TYPE_ETHREQ) {
			ate_printf(MSG_ERROR, "Command_Type error = %x\n", Command_Type);
			return;
		}
		task_dispatcher(inpkt,len,0);
	} else if(be2cpu32/*ntohl*/(p_racfgh->magic_no) == NEW_MAGIC_NO){