summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>1999-10-21 02:18:09 (GMT)
committerhobbs <hobbs>1999-10-21 02:18:09 (GMT)
commit54ed06429ec77527ac56a679894eb97fd54b9152 (patch)
treef22ae8591ad52edd536293852749b44aa0567917
parentf8731757a44ea7d7862aca7eb78ef21303b70e63 (diff)
downloadtcl-54ed06429ec77527ac56a679894eb97fd54b9152.zip
tcl-54ed06429ec77527ac56a679894eb97fd54b9152.tar.gz
tcl-54ed06429ec77527ac56a679894eb97fd54b9152.tar.bz2
* unix/tclUnixNotfy.c: fixed event/io threading problems by
making triggerPipe non-blocking
-rw-r--r--unix/tclUnixNotfy.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c
index 4053e4a..d116f8a 100644
--- a/unix/tclUnixNotfy.c
+++ b/unix/tclUnixNotfy.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixNotfy.c,v 1.5 1999/07/02 06:05:34 welch Exp $
+ * RCS: @(#) $Id: tclUnixNotfy.c,v 1.6 1999/10/21 02:18:09 hobbs Exp $
*/
#include "tclInt.h"
@@ -719,15 +719,12 @@ Tcl_WaitForEvent(timePtr)
waitingListPtr = tsdPtr;
tsdPtr->onList = 1;
- Tcl_MutexUnlock(&notifierMutex);
write(triggerPipe, "", 1);
- Tcl_MutexLock(&notifierMutex);
}
memset((VOID *) tsdPtr->readyMasks, 0, 3*MASK_SIZE*sizeof(fd_mask));
if (!tsdPtr->eventReady) {
-
Tcl_ConditionWait(&tsdPtr->waitCV, &notifierMutex, timePtr);
}
tsdPtr->eventReady = 0;
@@ -750,10 +747,7 @@ Tcl_WaitForEvent(timePtr)
}
tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
tsdPtr->onList = 0;
- Tcl_MutexUnlock(&notifierMutex);
write(triggerPipe, "", 1);
- Tcl_MutexLock(&notifierMutex);
-
}
@@ -870,10 +864,18 @@ NotifierThreadProc(clientData)
if (fcntl(receivePipe, F_SETFL, status) < 0) {
panic("NotifierThreadProc: could not make receive pipe non blocking.");
}
+ status = fcntl(fds[1], F_GETFL);
+ status |= O_NONBLOCK;
+ if (fcntl(fds[1], F_SETFL, status) < 0) {
+ panic("NotifierThreadProc: could not make trigger pipe non blocking.");
+ }
#else
if (ioctl(receivePipe, (int) FIONBIO, &status) < 0) {
panic("NotifierThreadProc: could not make receive pipe non blocking.");
}
+ if (ioctl(fds[1], (int) FIONBIO, &status) < 0) {
+ panic("NotifierThreadProc: could not make trigger pipe non blocking.");
+ }
#endif
/*