Пример #1
0
	void tile_ready()
	{
		Glib::Mutex::Lock lock(mutex);
		if(!alive_flag)
		{
			tile_queue.clear();
			cond_tile_queue_empty.signal();
			return;
		}
		while(!tile_queue.empty() && alive_flag)
		{
			tile_t& tile(tile_queue.front());
			
//			if (getenv("SYNFIG_SHOW_TILE_OUTLINES"))
//			{
//				Color red(1,0,0);
//				tile.surface.fill(red, 0, 0, 1, tile.surface.get_h());
//				tile.surface.fill(red, 0, 0, tile.surface.get_w(), 1);
//			}
			
			alive_flag=warm_target->add_tile(tile.surface,tile.x,tile.y);
			
			tile_queue.pop_front();
		}
		cond_tile_queue_empty.signal();
	}
Пример #2
0
void ThreadSleep::Sleep(unsigned int milliseconds)
{
	Glib::Mutex condMutex;
	Glib::Cond condition;
	condMutex.lock();
	Glib::TimeVal wait_period(milliseconds/1000,milliseconds%1000);
	Glib::TimeVal abs_time;
	abs_time.assign_current_time();
	abs_time.add(wait_period);
	condition.timed_wait(condMutex, abs_time);
	condMutex.unlock();
}
Пример #3
0
	virtual void end_frame()
	{
#ifdef SINGLE_THREADED
		if (!single_threaded())
		{
#endif
			while(alive_flag)
			{
				Glib::Mutex::Lock lock(mutex);
				Glib::TimeVal end_time;
				
				end_time.assign_current_time();
				end_time.add_microseconds(BOREDOM_TIMEOUT);
				
				if(!tile_queue.empty() && alive_flag)
				{
					if(cond_tile_queue_empty.timed_wait(mutex,end_time))
						break;
				}
				else
					break;
			}
#ifdef SINGLE_THREADED
		}
#endif
		Glib::Mutex::Lock lock(mutex);
		if(!alive_flag)
			return;
		return warm_target->end_frame();
	}
Пример #4
0
	void frame_ready()
	{
		Glib::Mutex::Lock lock(mutex);
		if(alive_flag)
			alive_flag=warm_target->put_surface(surface, callback);
#ifdef SINGLE_THREADED
		if (!single_threaded())
#endif
			cond_frame_queue_empty.signal();
		ready_next=true;
	}
Пример #5
0
	virtual void end_frame()
	{
		{
			Glib::Mutex::Lock lock(mutex);

			if(!alive_flag)
				return;
			ready_next=false;

#ifdef GLIB_DISPATCHER_BROKEN
		ready_connection=Glib::signal_timeout().connect(
			sigc::bind_return(
				sigc::mem_fun(*this,&AsyncTarget_Scanline::frame_ready),
				false
			)
			,0
		);
#else
			frame_ready_signal();
#endif
		}

#ifdef SINGLE_THREADED
		if (single_threaded())
			signal_progress()();
		else
#endif
		{

			Glib::TimeVal end_time;

			end_time.assign_current_time();
			end_time.add_microseconds(BOREDOM_TIMEOUT);

			while(alive_flag && !ready_next)
			{
				Glib::Mutex::Lock lock(mutex);
				if(cond_frame_queue_empty.timed_wait(mutex, end_time))
					break;
			}
		}
	}