|
libeblearntools
|
A mutex abstraction class. More...
#include <thread.h>
Public Member Functions | |
| mutex () | |
| bool | trylock () |
| void | lock () |
| Lock the mutex (wait if necessary until mutex is available). | |
| void | unlock () |
| Unlock the mutex. | |
A mutex abstraction class.
| ebl::mutex::mutex | ( | ) |
Use non-recursive mutex so that lock can be called multiple times by the same thread but require only 1 unlock. Also this has to be the 'fast' kind of mutex that blocks the thread until locking/unlocking is successful.
| bool ebl::mutex::trylock | ( | ) |
Try to lock the mutex but do not wait until mutex is available. This returns true if mutex was available and successfully locked, false otherwise.