UCommon
|
Atomic spinlock class. More...
#include <atomic.h>
Public Member Functions | |
bool | acquire (void) volatile |
NAMESPACE_UCOMMON Acquire the lock. | |
void | release (void) volatile |
Release an acquired spinlock. | |
spinlock () | |
Construct and initialize spinlock. | |
void | wait (void) volatile |
Wait for and aquire spinlock. | |
Atomic spinlock class.
Used as high-performance sync lock between threads.
bool ucommon::Atomic::spinlock::acquire | ( | void | ) | volatile |
NAMESPACE_UCOMMON Acquire the lock.
If the lock is not acquired, one "spins" by doing something else. One suggestion is using thread::yield.