|
Honeycomb
0.1
Component-Model Framework
|
Scoped transfer of mutex ownership between two locks. More...
#include <Transfer.h>


Public Types | |
| typedef ToLock::Lockable | Lockable |
Public Member Functions | |
| TransferLock (FromLock &lock) | |
Transfer ownership of mutex from lock to an instance of ToLock. More... | |
| ~TransferLock () | |
| void | lock () |
| void | unlock () |
| bool | owns () const |
| operator bool () const | |
| Lockable & | mutex () |
| Lockable & | release () |
Scoped transfer of mutex ownership between two locks.
Ownership is transferred to ToLock on construction, and then returned to FromLock on destruction.
This class can be used to atomically acquire a unique writer lock from a shared reader lock:
SharedMutex mutex;
SharedMutex::SharedScoped readLock(mutex);
//Read ownership acquired, read data...
{
TransferLock<decltype(readLock), SharedMutex::Scoped> writeLock(readLock);
//Write ownership acquired in this scope, write data...
}
//Read ownership re-acquired | typedef ToLock::Lockable honey::TransferLock< FromLock, ToLock >::Lockable |
|
inline |
Transfer ownership of mutex from lock to an instance of ToLock.
|
inline |
|
inline |
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
1.8.10