condition_mutex
Copyright (C) 2005 IENT-RWTH Aachen
Gathers a spin_mutex and a condition together
Groups
Multithreading Functions | |
![]() |
Waits until a lock can be acquired |
![]() |
Releases the lock |
![]() |
Restarts one of the threads that are waiting on the condition variable |
![]() |
Waits for the condition variable to be signaled |
Example
int x,y; typedef gmt::condition_mutex mutex_type; mutex_type cond; //First thread { mutex_type::scoped_lock lock(cond); while (x<=y) cond.wait(); // operate on x and y } // Second thread { mutex_type::scoped_lock lock(cond); // modify x and y if (x>y) cond.signal(); }
See Also