summaryrefslogtreecommitdiffstats
path: root/generic/tclIORChan.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclIORChan.c')
-rw-r--r--generic/tclIORChan.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index bbb5b88..b059c79 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -741,6 +741,27 @@ TclChanCreateObjCmd(
*----------------------------------------------------------------------
*/
+typedef struct PostEvent {
+ Tcl_Event event; /* Basic event data, has to be first item */
+ Tcl_Channel chan;
+ int events;
+} PostEvent;
+
+static int
+CallNotify(
+ Tcl_Event *evPtr,
+ int flags)
+{
+ PostEvent *pevPtr = (PostEvent *)evPtr;
+ Channel *chanPtr = (Channel *)pevPtr->chan;
+
+ if (chanPtr->typePtr != NULL) {
+ Tcl_NotifyChannel(pevPtr->chan, pevPtr->events);
+ }
+ TclChannelRelease(pevPtr->chan);
+ return 1;
+}
+
int
TclChanPostEventObjCmd(
ClientData clientData,
@@ -769,6 +790,7 @@ TclChanPostEventObjCmd(
int events; /* Mask of events to post */
ReflectedChannelMap* rcmPtr; /* Map of reflected channels with handlers in this interp */
Tcl_HashEntry* hPtr; /* Entry in the above map */
+ PostEvent *pevPtr;
/*
* Number of arguments...
@@ -857,7 +879,12 @@ TclChanPostEventObjCmd(
* We have the channel and the events to post.
*/
- Tcl_NotifyChannel(chan, events);
+ pevPtr = (PostEvent *)ckalloc(sizeof(PostEvent));
+ pevPtr->event.proc = CallNotify;
+ pevPtr->chan = chan;
+ pevPtr->events = events;
+ TclChannelPreserve(chan);
+ Tcl_QueueEvent((Tcl_Event *)pevPtr, TCL_QUEUE_HEAD);
/*
* Squash interp results left by the event script.
@@ -1508,7 +1535,7 @@ ReflectWatch(
mask &= rcPtr->mode;
- if (mask == rcPtr->interest) {
+ if (0 && mask == rcPtr->interest) {
/*
* Same old, same old, why should we do something?
*/