MLIB
|
Smart write pointer for a shared memory area. More...
#include <shmem.h>
Public Member Functions | |
lockw (shmem< S, B > &mem_) | |
S * | operator-> () |
operator S* () | |
Smart write pointer for a shared memory area.
lockw objects can be used in code like this:
struct DATA { int i; }; shmem<DATA> mem("SHARED_DATA"); try { lockw<DATA> wl(mem); wl->i = 2; } catch (runtime_error& err) { printf ("write lock failed\n"); }
When created, the object places a write lock on the shared memory area that stays in place until the object is destroyed. The object can than be used as a (non-const) pointer to the structure in the shared memory area.