#include <mutex>
#include <condition_variable>
#include <atomic>
#include <boost/thread.hpp>
Go to the source code of this file.
|
| #define | DEV_GUARDED(MUTEX) for (GenericGuardBool<Guard, Mutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
| | Simple block guard. The expression/block following is guarded though the given mutex. Usage: More...
|
| |
| #define | DEV_READ_GUARDED(MUTEX) for (GenericGuardBool<ReadGuard, SharedMutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
| |
| #define | DEV_WRITE_GUARDED(MUTEX) for (GenericGuardBool<WriteGuard, SharedMutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
| |
| #define | DEV_RECURSIVE_GUARDED(MUTEX) for (GenericGuardBool<RecursiveGuard, RecursiveMutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
| |
| #define | DEV_UNGUARDED(MUTEX) for (GenericUnguardBool<Mutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
| |
| #define | DEV_READ_UNGUARDED(MUTEX) for (GenericUnguardSharedBool<SharedMutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
| |
| #define | DEV_WRITE_UNGUARDED(MUTEX) for (GenericUnguardBool<SharedMutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
| |
- Author
- Gav Wood i@gav.nosp@m.wood.nosp@m..com
- Date
- 2014
Definition in file Guards.h.
◆ DEV_GUARDED
| #define DEV_GUARDED |
( |
|
MUTEX | ) |
for (GenericGuardBool<Guard, Mutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
Simple block guard. The expression/block following is guarded though the given mutex. Usage:
unsigned d;
...
ETH_(m) d = 1;
...
ETH_(m) { for (auto d = 10; d > 0; --d) foo(d); d = 0; }
There are several variants of this basic mechanism for different Mutex types and Guards.
There is also the UNGUARD variant which allows an unguarded expression/block to exist within a guarded expression. eg:
int d;
...
ETH_GUARDED(m)
{
for (auto d = 50; d > 25; --d)
foo(d);
ETH_UNGUARDED(m)
bar();
for (; d > 0; --d)
foo(d);
}
Definition at line 133 of file Guards.h.
◆ DEV_READ_GUARDED
| #define DEV_READ_GUARDED |
( |
|
MUTEX | ) |
for (GenericGuardBool<ReadGuard, SharedMutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
◆ DEV_READ_UNGUARDED
| #define DEV_READ_UNGUARDED |
( |
|
MUTEX | ) |
for (GenericUnguardSharedBool<SharedMutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
◆ DEV_RECURSIVE_GUARDED
| #define DEV_RECURSIVE_GUARDED |
( |
|
MUTEX | ) |
for (GenericGuardBool<RecursiveGuard, RecursiveMutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
◆ DEV_UNGUARDED
| #define DEV_UNGUARDED |
( |
|
MUTEX | ) |
for (GenericUnguardBool<Mutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
◆ DEV_WRITE_GUARDED
| #define DEV_WRITE_GUARDED |
( |
|
MUTEX | ) |
for (GenericGuardBool<WriteGuard, SharedMutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |
◆ DEV_WRITE_UNGUARDED
| #define DEV_WRITE_UNGUARDED |
( |
|
MUTEX | ) |
for (GenericUnguardBool<SharedMutex> __eth_l(MUTEX); __eth_l.b; __eth_l.b = false) |