Public Member Functions | |
| QSemaphore () | |
| default ctor | |
| QSemaphore (bool owner, int semId) | |
| ctor with semaphore initialization | |
| virtual | ~QSemaphore () |
| dtor | |
| bool | Init (bool owner, int semId) |
| initialize semaphore | |
| bool | Lock (bool lock) |
| lock semaphore | |
| bool | IsLocked (bool &result) |
| check whether semaphore is currently locked | |
| bool | CanLock (bool &result) |
| inverse of IsLocked() | |
| bool | SetTimeout (long timeoutMs) |
| set timeout to use when trying to lock semaphore | |
| long | GetTimeout () const |
| get timeout in ms | |
| const QError & | GetError () |
| get error associated to the last operation | |
Private Attributes | |
| int | fSemHandle |
| int | fSemId |
| long | fTimeoutMs |
| bool | fOwner |
| QError | fError |
Classes | |
| union | semun |
| this union is needed by semctl() (see man semctl) More... | |
| QSemaphore::QSemaphore | ( | ) |
default ctor
When using this ctor the created object must be initialized using the Init() method before it can be used.
| QSemaphore::QSemaphore | ( | bool | owner, | |
| int | semId | |||
| ) |
| bool QSemaphore::Init | ( | bool | owner, | |
| int | semId | |||
| ) |
initialize semaphore
References fOwner, fSemHandle, fSemId, QError::Set(), and QSemaphore::semun::val.
Referenced by QGuiSharedMemory::QGuiSharedMemory(), and QSemaphore().
| bool QSemaphore::Lock | ( | bool | lock | ) |
lock semaphore
References fSemHandle, fTimeoutMs, IsLocked(), and QError::Set().
Referenced by QTimerDispatcher::ExecuteThread(), QGuiSharedMemory::GetValue(), and QGuiSharedMemory::SetValue().
| bool QSemaphore::IsLocked | ( | bool & | result | ) |
check whether semaphore is currently locked
| result | filled with current semaphore status (locked or not) |
References fSemHandle, and QError::Set().
| bool QSemaphore::SetTimeout | ( | long | timeoutMs | ) |
set timeout to use when trying to lock semaphore
| timeoutMs | timeout in ms in range 0..1000 (0 means no wait). |
References fTimeoutMs.
int QSemaphore::fSemHandle [private] |
semaphore handler
Referenced by Init(), IsLocked(), Lock(), and ~QSemaphore().
int QSemaphore::fSemId [private] |
semaphore id
Referenced by Init(), and ~QSemaphore().
long QSemaphore::fTimeoutMs [private] |
semaphore lock timeout in ms: 0 means no wait, -1 means wait forever
Referenced by GetTimeout(), Lock(), and SetTimeout().
bool QSemaphore::fOwner [private] |
whether this objet is the owner of the semaphore
Referenced by Init(), and ~QSemaphore().
1.5.6