summaryrefslogtreecommitdiffstats
path: root/kdesktop/lockeng.cc
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2015-04-13 15:05:11 -0500
committerTimothy Pearson <[email protected]>2015-04-13 15:05:11 -0500
commitab8dfbaaa482e8de7ebd3a5eec1065b38d5299f6 (patch)
treeb690b4c80a4f2a828017e9db5379a2098edc8f98 /kdesktop/lockeng.cc
parentc1b62c1c4ca17ed5605a6d89dad674c477e1cbd8 (diff)
downloadtdebase-ab8dfbaaa482e8de7ebd3a5eec1065b38d5299f6.tar.gz
tdebase-ab8dfbaaa482e8de7ebd3a5eec1065b38d5299f6.zip
Do not unblock signals in main thread when waiting for kdesktop_lock response
This prevents incorrect cancellation of internal xcb poll() methods and subsequent deadlock
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
+}