diff options
-rw-r--r-- | generic/tclIORChan.c | 31 | ||||
-rw-r--r-- | tests/ioCmd.test | 8 |
2 files changed, 6 insertions, 33 deletions
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index b059c79..bbb5b88 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -741,27 +741,6 @@ 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, @@ -790,7 +769,6 @@ 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... @@ -879,12 +857,7 @@ TclChanPostEventObjCmd( * We have the channel and the events to post. */ - 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); + Tcl_NotifyChannel(chan, events); /* * Squash interp results left by the event script. @@ -1535,7 +1508,7 @@ ReflectWatch( mask &= rcPtr->mode; - if (0 && mask == rcPtr->interest) { + if (mask == rcPtr->interest) { /* * Same old, same old, why should we do something? */ diff --git a/tests/ioCmd.test b/tests/ioCmd.test index c706e50..5a76d48 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -1949,26 +1949,26 @@ test iocmd-31.6 {chan postevent, posted events do happen} -match glob -body { set c [chan create {r w} foo] note [fileevent $c readable {note TOCK}] set stop [after 10000 {note TIMEOUT}] - after 1000 {chan postevent $c r} + after 1000 {note [chan postevent $c r]} vwait ::res catch {after cancel $stop} close $c rename foo {} set res -} -result {{watch rc* read} {} TOCK {watch rc* {}}} +} -result {{watch rc* read} {} TOCK {} {watch rc* {}}} test iocmd-31.7 {chan postevent, posted events do happen} -match glob -body { set res {} proc foo {args} {oninit; onfinal; track; return} set c [chan create {r w} foo] note [fileevent $c writable {note TOCK}] set stop [after 10000 {note TIMEOUT}] - after 1000 {chan postevent $c w} + after 1000 {note [chan postevent $c w]} vwait ::res catch {after cancel $stop} close $c rename foo {} set res -} -result {{watch rc* write} {} TOCK {watch rc* {}}} +} -result {{watch rc* write} {} TOCK {} {watch rc* {}}} test iocmd-31.8 {chan postevent after close throws error} -match glob -setup { proc foo {args} {oninit; onfinal; track; return} proc dummy args { return } |