summaryrefslogtreecommitdiffstats
path: root/src/gui/embedded/qwslock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/embedded/qwslock.cpp')
-rw-r--r--src/gui/embedded/qwslock.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp
index a64dc3d..1d9bfb6 100644
--- a/src/gui/embedded/qwslock.cpp
+++ b/src/gui/embedded/qwslock.cpp
@@ -76,7 +76,9 @@ QWSLock::QWSLock()
perror("QWSLock::QWSLock");
qFatal("Unable to create semaphore");
}
+#ifndef QT_NO_QWS_SIGNALHANDLER
QWSSignalHandler::instance()->addSemaphore(semId);
+#endif
qt_semun semval;
semval.val = 1;
@@ -103,15 +105,23 @@ QWSLock::QWSLock()
QWSLock::QWSLock(int id)
{
semId = id;
+#ifndef QT_NO_QWS_SIGNALHANDLER
QWSSignalHandler::instance()->addSemaphore(semId);
+#endif
lockCount[0] = lockCount[1] = 0;
}
QWSLock::~QWSLock()
{
- if (semId == -1)
- return;
- QWSSignalHandler::instance()->removeSemaphore(semId);
+ if (semId != -1) {
+#ifndef QT_NO_QWS_SIGNALHANDLER
+ QWSSignalHandler::instance()->removeSemaphore(semId);
+#else
+ qt_semun semval;
+ semval.val = 0;
+ semctl(semId, 0, IPC_RMID, semval);
+#endif
+ }
}
static bool forceLock(int semId, unsigned short semNum, int)