summaryrefslogtreecommitdiffstats
path: root/generic/tclIORChan.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-04-18 15:32:16 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-04-18 15:32:16 (GMT)
commitf7b4c00c2817d11f545b2bbf7ee60e6567ab169c (patch)
tree573f149c24b58c211466c72770d8b214e324dd70 /generic/tclIORChan.c
parente3caaff1547bb50b7e0b41f1aaf596f379906b34 (diff)
downloadtcl-f7b4c00c2817d11f545b2bbf7ee60e6567ab169c.zip
tcl-f7b4c00c2817d11f545b2bbf7ee60e6567ab169c.tar.gz
tcl-f7b4c00c2817d11f545b2bbf7ee60e6567ab169c.tar.bz2
Fix [18f4a94d03] by backing out [9bcec7cd880540c3] (again)
Diffstat (limited to 'generic/tclIORChan.c')
-rw-r--r--generic/tclIORChan.c66
1 files changed, 6 insertions, 60 deletions
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 4e938ae..d284f15 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -58,8 +58,6 @@ static int ReflectSetOption(void *clientData,
const char *newValue);
static int ReflectTruncate(void *clientData,
long long length);
-static void TimerRunRead(void *clientData);
-static void TimerRunWrite(void *clientData);
/*
* The C layer channel type/driver definition used by the reflection.
@@ -121,17 +119,6 @@ typedef struct {
int dead; /* Boolean signal that some operations
* should no longer be attempted. */
- Tcl_TimerToken readTimer; /*
- A token for the timer that is scheduled in
- order to call Tcl_NotifyChannel when the
- channel is readable
- */
- Tcl_TimerToken writeTimer; /*
- A token for the timer that is scheduled in
- order to call Tcl_NotifyChannel when the
- channel is writable
- */
-
/*
* Note regarding the usage of timers.
*
@@ -141,9 +128,11 @@ typedef struct {
*
* See 'refchan', 'memchan', etc.
*
- * A timer is used here as well in order to ensure at least on pass through
- * the event loop when a channel becomes ready. See issues 67a5eabbd3d1 and
- * ef28eb1f1516.
+ * Here this is _not_ required. Interest in events is posted to the Tcl
+ * level via 'watch'. And posting of events is possible from the Tcl level
+ * as well, via 'chan postevent'. This means that the generation of all
+ * events, fake or not, timer based or not, is completely in the hands of
+ * the Tcl level. Therefore no timer here.
*/
} ReflectedChannel;
@@ -959,18 +948,7 @@ TclChanPostEventObjCmd(
#if TCL_THREADS
if (rcPtr->owner == rcPtr->thread) {
#endif
- if (events & TCL_READABLE) {
- if (rcPtr->readTimer == NULL) {
- rcPtr->readTimer = Tcl_CreateTimerHandler(SYNTHETIC_EVENT_TIME,
- TimerRunRead, rcPtr);
- }
- }
- if (events & TCL_WRITABLE) {
- if (rcPtr->writeTimer == NULL) {
- rcPtr->writeTimer = Tcl_CreateTimerHandler(SYNTHETIC_EVENT_TIME,
- TimerRunWrite, rcPtr);
- }
- }
+ Tcl_NotifyChannel(chan, events);
#if TCL_THREADS
} else {
ReflectEvent *ev = (ReflectEvent *)ckalloc(sizeof(ReflectEvent));
@@ -1018,24 +996,6 @@ TclChanPostEventObjCmd(
#undef EVENT
}
-static void
-TimerRunRead(
- void *clientData)
-{
- ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
- rcPtr->readTimer = NULL;
- Tcl_NotifyChannel(rcPtr->chan, TCL_READABLE);
-}
-
-static void
-TimerRunWrite(
- void *clientData)
-{
- ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
- rcPtr->writeTimer = NULL;
- Tcl_NotifyChannel(rcPtr->chan, TCL_WRITABLE);
-}
-
/*
* Channel error message marshalling utilities.
*/
@@ -1234,12 +1194,6 @@ ReflectClose(
ckfree(tctPtr);
((Channel *)rcPtr->chan)->typePtr = NULL;
}
- if (rcPtr->readTimer != NULL) {
- Tcl_DeleteTimerHandler(rcPtr->readTimer);
- }
- if (rcPtr->writeTimer != NULL) {
- Tcl_DeleteTimerHandler(rcPtr->writeTimer);
- }
Tcl_EventuallyFree(rcPtr, FreeReflectedChannel);
return EOK;
}
@@ -1309,12 +1263,6 @@ ReflectClose(
ckfree(tctPtr);
((Channel *)rcPtr->chan)->typePtr = NULL;
}
- if (rcPtr->readTimer != NULL) {
- Tcl_DeleteTimerHandler(rcPtr->readTimer);
- }
- if (rcPtr->writeTimer != NULL) {
- Tcl_DeleteTimerHandler(rcPtr->writeTimer);
- }
Tcl_EventuallyFree(rcPtr, FreeReflectedChannel);
return (result == TCL_OK) ? EOK : EINVAL;
}
@@ -2280,8 +2228,6 @@ NewReflectedChannel(
rcPtr->chan = NULL;
rcPtr->interp = interp;
rcPtr->dead = 0;
- rcPtr->readTimer = 0;
- rcPtr->writeTimer = 0;
#if TCL_THREADS
rcPtr->thread = Tcl_GetCurrentThread();
#endif