A class for synchronized operation on a (one) shared memory segment. More...
#include <libppbase/base/SynchronizedSharedMemory.h>
Public Types | |
| enum | waitE { waitNone = 0, waitEmpty = 1, waitFull = 2 } |
Specifies the events to signal and wait for in the lock() and unlock() methods. More... | |
Public Member Functions | |
| SynchronizedSharedMemory () | |
| Creates an empty object. | |
| ~SynchronizedSharedMemory () | |
| Unmaps the shared memory segment if it is still mapped. | |
| void | close () |
| Closes the shared memory segment. | |
| void | destroy () |
| Destroys the shared memory segment. | |
| void | lock (waitE wait=waitNone) |
| Locks the shared memory segment for exclusive access, possibly signalling and waiting for a condition. | |
| void | open (const char *name, unsigned size, int flags=0) |
| Opens or creates a shared memory segment. | |
| void | unlock (waitE wait=waitNone) |
| Unlocks the shared memory segment from exclusive access, possibly signalling a condition. | |
A class for synchronized operation on a (one) shared memory segment.
| void base::SynchronizedSharedMemory::destroy | ( | ) |
Destroys the shared memory segment.
Under Linux you must explicitly destroy a shared memory segment with this method. Windows destroys a shared memory segment when there are no more open handles to it, so this method does nothing.
Reimplemented from base::SharedMemory.
| void base::SynchronizedSharedMemory::lock | ( | waitE | wait = waitNone |
) |
Locks the shared memory segment for exclusive access, possibly signalling and waiting for a condition.
wait specifies the condition to signal and wait for:
| wait | specifies the condition to signal and wait for |
| void base::SynchronizedSharedMemory::open | ( | const char * | name, | |
| unsigned | size, | |||
| int | flags = 0 | |||
| ) |
Opens or creates a shared memory segment.
| name | the segment name, must be an integer in string form under Linux | |
| size | size of the segment in bytes | |
| flags | open flags |
Reimplemented from base::SharedMemory.
| void base::SynchronizedSharedMemory::unlock | ( | waitE | wait = waitNone |
) |
Unlocks the shared memory segment from exclusive access, possibly signalling a condition.
wait specifies the condition to signal:
| wait | specifies the condition to signal |
1.7.1