|
CoopSync for TBB 0.1.0
Cooperative synchronization primitives for TBB resumable tasks
|
A mutex that can be used to synchronize access to shared resources. The mutex is non-recursive and provides no fairness guarantees. An attempt to acquire a mutex that is already in acquired state suspends the calling task until the mutex can be acquired. More...
#include <coopsync_tbb/mutex.hpp>
Classes | |
| class | scoped_lock |
| RAII wrapper for mutex that acquires the mutex on construction and releases it on destruction. More... | |
Public Member Functions | |
| mutex ()=default | |
| Constructs a new mutex. The mutex is initially unlocked. | |
| mutex (const mutex &)=delete | |
| The mutex is not copy-constructible. | |
| mutex & | operator= (const mutex &)=delete |
| The mutex is not copy-assignable. | |
| mutex (mutex &&)=delete | |
| The mutex is not move-constructible. | |
| mutex & | operator= (mutex &&)=delete |
| Mutex is not move-assignable. | |
| ~mutex () | |
| Destroys the mutex. | |
| bool | try_lock () noexcept |
| Attempts to acquire the mutex without suspending. | |
| void | lock () |
| Acquires the mutex, suspending the calling task if necessary until the mutex becomes available. | |
| void | unlock () |
| Releases the mutex. If there are tasks suspended on the mutex, exactly one of them is resumed and acquires the mutex. | |
A mutex that can be used to synchronize access to shared resources. The mutex is non-recursive and provides no fairness guarantees. An attempt to acquire a mutex that is already in acquired state suspends the calling task until the mutex can be acquired.
| coopsync_tbb::mutex::~mutex | ( | ) |
Destroys the mutex.
| void coopsync_tbb::mutex::lock | ( | ) |
Acquires the mutex, suspending the calling task if necessary until the mutex becomes available.
|
nodiscardnoexcept |
Attempts to acquire the mutex without suspending.