mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-06-22 00:42:02 +01:00
better interface for critical threaded sections
This commit is contained in:
@ -92,6 +92,14 @@ void ThreadPool::addJob(Job newJob)
|
||||
condition_.notify_one();
|
||||
}
|
||||
|
||||
// critical section ////////////////////////////////////////////////////////////
|
||||
void ThreadPool::critical(Job fn)
|
||||
{
|
||||
unique_lock<mutex> lock(mutex_);
|
||||
|
||||
fn();
|
||||
}
|
||||
|
||||
// wait for completion /////////////////////////////////////////////////////////
|
||||
void ThreadPool::terminate(void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user