diff options
author | Ritt Konstantin <ritt.ks@gmail.com> | 2011-06-01 14:49:43 (GMT) |
---|---|---|
committer | Harald Fernengel <harald.fernengel@nokia.com> | 2011-06-01 14:49:43 (GMT) |
commit | 9f71cffea1d5cdac94ae7368ffa7f54183ac33a4 (patch) | |
tree | 6594f8e2f5d09d13b88de8fa95d40c069a9d1181 /src/gui/embedded/qwslock.cpp | |
parent | 6896244f266becfb5807985c5628c8f0a775ce76 (diff) | |
download | Qt-9f71cffea1d5cdac94ae7368ffa7f54183ac33a4.zip Qt-9f71cffea1d5cdac94ae7368ffa7f54183ac33a4.tar.gz Qt-9f71cffea1d5cdac94ae7368ffa7f54183ac33a4.tar.bz2 |
drop the SysV semaphores -specific code out from QWSSignalHandler
it is safe to call the QLock/QWSLock desctructors instead on normal exit
where both lists should be empty;
on crash, we don't care about semi-alive objects
and the only important thing is to unregister the system semaphores.
Merge-request: 1237
Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
Diffstat (limited to 'src/gui/embedded/qwslock.cpp')
-rw-r--r-- | src/gui/embedded/qwslock.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp index 67f8bd8..c14f50b 100644 --- a/src/gui/embedded/qwslock.cpp +++ b/src/gui/embedded/qwslock.cpp @@ -70,6 +70,10 @@ QWSLock::QWSLock(int id) : semId(id) { static unsigned short initialValues[3] = { 1, 1, 0 }; +#ifndef QT_NO_QWS_SIGNALHANDLER + QWSSignalHandler::instance()->addWSLock(this); +#endif + if (semId == -1) { semId = semget(IPC_PRIVATE, 3, IPC_CREAT | 0666); if (semId == -1) { @@ -86,22 +90,19 @@ QWSLock::QWSLock(int id) : semId(id) } lockCount[0] = lockCount[1] = 0; - -#ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->addSemaphore(semId); -#endif } QWSLock::~QWSLock() { - if (semId != -1) { #ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->removeSemaphore(semId); -#else + QWSSignalHandler::instance()->removeWSLock(this); +#endif + + if (semId != -1) { qt_semun semval; semval.val = 0; semctl(semId, 0, IPC_RMID, semval); -#endif + semId = -1; } } |