#include <semaphore.h>
Public Methods | |
Semaphore (const String &name) | |
Constructor. More... | |
~Semaphore () | |
Destructor. | |
void | wait () |
Lock semaphore. More... | |
void | release () |
Unlock semaphore. More... | |
void | reset () |
Reset semaphore. More... | |
Private Attributes | |
int | _semid |
unix semaphore identifier. |
This class implements IPC semaphore. Implementation of this class is platform/system dependent. Semaphore is automatically locked after it is created.
Definition at line 47 of file semaphore.h.
|
Constructor. Opens a semaphore with given name. If semaphore doesn't exist, new one is created. It is automatically locked after it is created.
Definition at line 37 of file semaphore.cpp. |
|
Unlock semaphore. This method releases semaphore locked by previous call to wait() method.
Definition at line 70 of file semaphore.cpp. Referenced by CommunShMem::initialize(), CommunShMem::operator<<(), CommunShMem::operator>>(), and CommunShMem::~CommunShMem().
|
|
Reset semaphore. It resets semaphore and sets its default value (locked by one). Implemented only on Unix systems because of troubles with JVM. Definition at line 80 of file semaphore.cpp. Referenced by Semaphore(), CommunShMem::initialize(), and CommunShMem::~CommunShMem().
|
|
Lock semaphore. If the semaphore is already locked, calling thread waits on semaphore until another process (or thread) will release it.
Definition at line 60 of file semaphore.cpp. Referenced by CommunShMem::initialize(), CommunShMem::isReady(), CommunShMem::operator<<(), and CommunShMem::operator>>().
|