mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-11-04 04:09:57 +01:00 
			
		
		
		
	fixed GH #424: Poco::Timer deadlock
This commit is contained in:
		@@ -62,13 +62,26 @@ void Timer::start(const AbstractTimerCallback& method, Thread::Priority priority
 | 
				
			|||||||
	Clock nextInvocation;
 | 
						Clock nextInvocation;
 | 
				
			||||||
	nextInvocation += static_cast<Clock::ClockVal>(_startInterval)*1000;
 | 
						nextInvocation += static_cast<Clock::ClockVal>(_startInterval)*1000;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	poco_assert (!_pCallback);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	FastMutex::ScopedLock lock(_mutex);	
 | 
						FastMutex::ScopedLock lock(_mutex);	
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (_pCallback)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							throw Poco::IllegalStateException("Timer already running");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_nextInvocation = nextInvocation;
 | 
						_nextInvocation = nextInvocation;
 | 
				
			||||||
	_pCallback = method.clone();
 | 
						_pCallback = method.clone();
 | 
				
			||||||
	_wakeUp.reset();
 | 
						_wakeUp.reset();
 | 
				
			||||||
 | 
						try
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
		threadPool.startWithPriority(priority, *this);
 | 
							threadPool.startWithPriority(priority, *this);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						catch (...)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							delete _pCallback;
 | 
				
			||||||
 | 
							_pCallback = 0;
 | 
				
			||||||
 | 
							throw;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user