示例#1
0
void Timer::start(const AbstractTimerCallback& method, Thread::Priority priority, ThreadPool& threadPool)
{
	Clock nextInvocation;
	nextInvocation += static_cast<Clock::ClockVal>(_startInterval)*1000;
	
	FastMutex::ScopedLock lock(_mutex);	

	if (_pCallback)
	{
		throw Poco::IllegalStateException("Timer already running");
	}

	_nextInvocation = nextInvocation;
	_pCallback = method.clone();
	_wakeUp.reset();
	try
	{
		threadPool.startWithPriority(priority, *this);
	}
	catch (...)
	{
		delete _pCallback;
		_pCallback = 0;
		throw;
	}
}
示例#2
0
void Timer::start(const AbstractTimerCallback& method, Thread::Priority priority, ThreadPool& threadPool)
{
	poco_assert (!_pCallback);

	FastMutex::ScopedLock lock(_mutex);	
	_pCallback = method.clone();
	_wakeUp.reset();
	threadPool.startWithPriority(priority, *this);
}
示例#3
0
文件: Timer.cpp 项目: Moqi/uWebKit
void Timer::start(const AbstractTimerCallback& method, Thread::Priority priority, ThreadPool& threadPool)
{
	Clock nextInvocation;
	nextInvocation += static_cast<Clock::ClockVal>(_startInterval)*1000;

	poco_assert (!_pCallback);

	FastMutex::ScopedLock lock(_mutex);	
	_nextInvocation = nextInvocation;
	_pCallback = method.clone();
	_wakeUp.reset();
	threadPool.startWithPriority(priority, *this);
}