summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixChan.c5
-rw-r--r--unix/tclUnixEvent.c5
-rw-r--r--unix/tclUnixNotfy.c50
3 files changed, 28 insertions, 32 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 629f9d0..cb3ba17 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixChan.c,v 1.93 2008/03/03 14:54:43 rmax Exp $
+ * RCS: @(#) $Id: tclUnixChan.c,v 1.93.2.1 2009/04/10 18:02:42 das Exp $
*/
#include "tclInt.h" /* Internal definitions for Tcl. */
@@ -2986,6 +2986,8 @@ Tcl_GetOpenFile(
return TCL_ERROR;
}
+#ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is
+ * in tclMacOSXNotify.c */
/*
*----------------------------------------------------------------------
*
@@ -3145,6 +3147,7 @@ TclUnixWaitForFile(
}
return result;
}
+#endif /* HAVE_COREFOUNDATION */
/*
*----------------------------------------------------------------------
diff --git a/unix/tclUnixEvent.c b/unix/tclUnixEvent.c
index 214bf4c..bc6aade 100644
--- a/unix/tclUnixEvent.c
+++ b/unix/tclUnixEvent.c
@@ -8,10 +8,12 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixEvent.c,v 1.9 2005/11/02 23:26:50 dkf Exp $
+ * RCS: @(#) $Id: tclUnixEvent.c,v 1.9.10.1 2009/04/10 18:02:42 das Exp $
*/
#include "tclInt.h"
+#ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is
+ * in tclMacOSXNotify.c */
/*
*----------------------------------------------------------------------
@@ -85,6 +87,7 @@ Tcl_Sleep(
}
}
+#endif /* HAVE_COREFOUNDATION */
/*
* Local Variables:
* mode: c
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c
index a78cabd..916951f 100644
--- a/unix/tclUnixNotfy.c
+++ b/unix/tclUnixNotfy.c
@@ -10,7 +10,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.34 2008/03/11 22:23:50 das Exp $
+ * RCS: @(#) $Id: tclUnixNotfy.c,v 1.34.2.1 2009/04/10 18:02:42 das Exp $
*/
#include "tclInt.h"
@@ -143,7 +143,7 @@ static ThreadSpecificData *waitingListPtr = NULL;
* pipe. Hence writing to this file descriptor will cause the select() system
* call to return and wake up the notifier thread.
*
- * You must hold the notifierMutex lock before accessing this list.
+ * You must hold the notifierMutex lock before writing to the pipe.
*/
static int triggerPipe = -1;
@@ -199,7 +199,7 @@ static int FileHandlerEventProc(Tcl_Event *evPtr, int flags);
* Initializes the platform specific notifier state.
*
* Results:
- * Returns a handle to the notifier state for this thread..
+ * Returns a handle to the notifier state for this thread.
*
* Side effects:
* None.
@@ -543,15 +543,17 @@ Tcl_DeleteFileHandler(
*/
if (fd+1 == tsdPtr->numFdBits) {
- tsdPtr->numFdBits = 0;
+ int numFdBits = 0;
+
for (i = fd-1; i >= 0; i--) {
if (FD_ISSET(i, &(tsdPtr->checkMasks.readable))
|| FD_ISSET(i, &(tsdPtr->checkMasks.writable))
|| FD_ISSET(i, &(tsdPtr->checkMasks.exceptional))) {
- tsdPtr->numFdBits = i+1;
+ numFdBits = i+1;
break;
}
}
+ tsdPtr->numFdBits = numFdBits;
}
/*
@@ -664,10 +666,9 @@ Tcl_WaitForEvent(
FileHandler *filePtr;
FileHandlerEvent *fileEvPtr;
int mask;
- Tcl_Time myTime;
+ Tcl_Time vTime;
#ifdef TCL_THREADS
int waitForFiles;
- Tcl_Time *myTimePtr;
#else
/*
* Impl. notes: timeout & timeoutPtr are used if, and only if threads are
@@ -696,22 +697,15 @@ Tcl_WaitForEvent(
* handler to do this scaling.
*/
- myTime.sec = timePtr->sec;
- myTime.usec = timePtr->usec;
-
- if (myTime.sec != 0 || myTime.usec != 0) {
- (*tclScaleTimeProcPtr) (&myTime, tclTimeClientData);
+ if (timePtr->sec != 0 || timePtr->usec != 0) {
+ vTime = *timePtr;
+ (*tclScaleTimeProcPtr) (&vTime, tclTimeClientData);
+ timePtr = &vTime;
}
-
-#ifdef TCL_THREADS
- myTimePtr = &myTime;
-#else
- timeout.tv_sec = myTime.sec;
- timeout.tv_usec = myTime.usec;
- timeoutPtr = &timeout;
-#endif /* TCL_THREADS */
-
#ifndef TCL_THREADS
+ timeout.tv_sec = timePtr->sec;
+ timeout.tv_usec = timePtr->usec;
+ timeoutPtr = &timeout;
} else if (tsdPtr->numFdBits == 0) {
/*
* If there are no threads, no timeout, and no fds registered, then
@@ -722,11 +716,7 @@ Tcl_WaitForEvent(
*/
return -1;
-#endif /* !TCL_THREADS */
} else {
-#ifdef TCL_THREADS
- myTimePtr = NULL;
-#else
timeoutPtr = NULL;
#endif /* TCL_THREADS */
}
@@ -739,8 +729,7 @@ Tcl_WaitForEvent(
Tcl_MutexLock(&notifierMutex);
- waitForFiles = (tsdPtr->numFdBits > 0);
- if (myTimePtr != NULL && myTimePtr->sec == 0 && (myTimePtr->usec == 0
+ if (timePtr != NULL && timePtr->sec == 0 && (timePtr->usec == 0
#if defined(__APPLE__) && defined(__LP64__)
/*
* On 64-bit Darwin, pthread_cond_timedwait() appears to have a bug
@@ -748,7 +737,7 @@ Tcl_WaitForEvent(
* has already been exceeded by the system time; as a workaround,
* when given a very brief timeout, just do a poll. [Bug 1457797]
*/
- || myTimePtr->usec < 10
+ || timePtr->usec < 10
#endif
)) {
/*
@@ -761,8 +750,9 @@ Tcl_WaitForEvent(
waitForFiles = 1;
tsdPtr->pollState = POLL_WANT;
- myTimePtr = NULL;
+ timePtr = NULL;
} else {
+ waitForFiles = (tsdPtr->numFdBits > 0);
tsdPtr->pollState = 0;
}
@@ -789,7 +779,7 @@ Tcl_WaitForEvent(
FD_ZERO(&(tsdPtr->readyMasks.exceptional));
if (!tsdPtr->eventReady) {
- Tcl_ConditionWait(&tsdPtr->waitCV, &notifierMutex, myTimePtr);
+ Tcl_ConditionWait(&tsdPtr->waitCV, &notifierMutex, timePtr);
}
tsdPtr->eventReady = 0;