summaryrefslogtreecommitdiffstats
path: root/kdesktop/lock/lockprocess.cc
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2015-04-12 22:29:58 -0500
committerTimothy Pearson <[email protected]>2015-04-12 22:33:04 -0500
commite569dd46ac06ef5a5f2ad03a311640e1834c749f (patch)
tree152f23fe0787e4beb828934c58554d31bb5df6c9 /kdesktop/lock/lockprocess.cc
parent92d1f764023e933f1767335d074299230ac23a3f (diff)
downloadtdebase-e569dd46ac06ef5a5f2ad03a311640e1834c749f.tar.gz
tdebase-e569dd46ac06ef5a5f2ad03a311640e1834c749f.zip
Remove call to pthread_cancel() in kdesktop_lock
This resolves a sporadic deadlock during kdesktop_lock termination
Diffstat (limited to 'kdesktop/lock/lockprocess.cc')
-rw-r--r--kdesktop/lock/lockprocess.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc
index 4e3922a68..da12bd46c 100644
--- a/kdesktop/lock/lockprocess.cc
+++ b/kdesktop/lock/lockprocess.cc
@@ -81,6 +81,7 @@
#ifdef __linux__
#include <linux/stat.h>
+#include <pthread.h>
#endif
#include <X11/Xlib.h>
@@ -304,7 +305,7 @@ LockProcess::LockProcess()
//
LockProcess::~LockProcess()
{
- mControlPipeHandlerThread->terminate();
+ mControlPipeHandler->terminateThread();
mControlPipeHandlerThread->wait();
delete mControlPipeHandler;
// delete mControlPipeHandlerThread;
@@ -2828,6 +2829,9 @@ void LockProcess::saverReady() {
//
ControlPipeHandlerObject::ControlPipeHandlerObject() : TQObject() {
mParent = NULL;
+ mRunning = false;
+ mTerminate = false;
+ mThreadID = 0L;
}
ControlPipeHandlerObject::~ControlPipeHandlerObject() {
@@ -2835,10 +2839,14 @@ ControlPipeHandlerObject::~ControlPipeHandlerObject() {
}
void ControlPipeHandlerObject::run(void) {
+ mThreadID = pthread_self();
+ mRunning = true;
+
int display_number = atoi(TQString(XDisplayString(tqt_xdisplay())).replace(":","").ascii());
if (display_number < 0) {
printf("[kdesktop_lock] Warning: unable to create control socket. Interactive logon modules may not function properly.\n");
+ mRunning = false;
TQApplication::eventLoop()->exit(-1);
return;
}
@@ -2869,6 +2877,7 @@ void ControlPipeHandlerObject::run(void) {
if (!mParent->mPipeOpen) {
printf("[kdesktop_lock] Warning: unable to create control socket '%s'. Interactive logon modules may not function properly.\n", fifo_file);
+ mRunning = false;
TQApplication::eventLoop()->exit(-1);
return;
}
@@ -2880,7 +2889,7 @@ void ControlPipeHandlerObject::run(void) {
FD_SET(mParent->mPipe_fd, &rfds);
TQByteArray readbuf(128);
- while (mParent->mPipeOpen) {
+ while (mParent->mPipeOpen && !mTerminate) {
TQString inputcommand = "";
// Wait for mParent->mPipe_fd to receive input
@@ -2900,8 +2909,16 @@ void ControlPipeHandlerObject::run(void) {
}
}
+ mRunning = false;
TQApplication::eventLoop()->exit(0);
return;
}
+void ControlPipeHandlerObject::terminateThread() {
+ if (mRunning) {
+ mTerminate = true;
+ pthread_kill(mThreadID, SIGUSR1);
+ }
+}
+
#include "lockprocess.moc"