summaryrefslogtreecommitdiffstats
path: root/kdesktop/lockeng.cc
diff options
context:
space:
mode:
Diffstat (limited to 'kdesktop/lockeng.cc')
-rw-r--r--kdesktop/lockeng.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/kdesktop/lockeng.cc b/kdesktop/lockeng.cc
index 27b57bc51..43930e9e7 100644
--- a/kdesktop/lockeng.cc
+++ b/kdesktop/lockeng.cc
@@ -837,15 +837,13 @@ bool SaverEngine::waitForLockProcessStart() {
sigset_t empty_mask;
sigemptyset(&empty_mask);
- // wait for SIGUSR1, SIGUSR2, SIGTTIN, SIGCHLD
+ // ensure that SIGCHLD is not subjec to a race condition
sigemptyset(&new_mask);
- sigaddset(&new_mask, SIGUSR1);
- sigaddset(&new_mask, SIGUSR2);
- sigaddset(&new_mask, SIGTTIN);
sigaddset(&new_mask, SIGCHLD);
pthread_sigmask(SIG_BLOCK, &new_mask, NULL);
while ((mLockProcess.isRunning()) && (!mSaverProcessReady)) {
+ // wait for any signal to arrive
sigsuspend(&empty_mask);
}
pthread_sigmask(SIG_UNBLOCK, &new_mask, NULL);
@@ -858,11 +856,10 @@ bool SaverEngine::waitForLockEngage() {
sigemptyset(&empty_mask);
// wait for SIGUSR1, SIGUSR2, SIGTTIN
- pthread_sigmask(SIG_BLOCK, &mThreadBlockSet, NULL);
while ((mLockProcess.isRunning()) && (mState != Waiting) && (mState != Saving)) {
+ // wait for any signal to arrive
sigsuspend(&empty_mask);
}
- pthread_sigmask(SIG_UNBLOCK, &mThreadBlockSet, NULL);
return mLockProcess.isRunning();
}
@@ -882,4 +879,4 @@ void SaverEngineThreadHelperObject::terminateThread() {
if (eventLoop) {
eventLoop->exit(0);
}
-} \ No newline at end of file
+}