#include <mutex.h>
Public Member Functions | |
| scoped_lock () | |
| Construct lock that has not acquired a mutex. | |
| scoped_lock (mutex &mutex) | |
| Acquire lock on given mutex. | |
| ~scoped_lock () | |
| Release lock (if lock is held). | |
| void | acquire (mutex &mutex) |
| Acquire lock on given mutex. | |
| bool | try_acquire (mutex &mutex) |
| Try acquire lock on given mutex. | |
| void | release () |
| Release lock. | |
Friends | |
| class | mutex |
It helps to avoid the common problem of forgetting to release lock. It also nicely provides the "node" for queuing locks.
| tbb::mutex::scoped_lock::scoped_lock | ( | mutex & | mutex | ) | [inline] |
Acquire lock on given mutex.
Upon entry, *this should not be in the "have acquired a mutex" state.