diff options
author | andreask <andreask> | 2012-05-09 22:28:42 (GMT) |
---|---|---|
committer | andreask <andreask> | 2012-05-09 22:28:42 (GMT) |
commit | 2454e655e137710903fe501014aa0de7550297cc (patch) | |
tree | 10a287ec5db41cc48ec30c89bdee41e5db5d4bd9 /generic | |
parent | e20f1abdc32a0550e6c840dcb99c848b39d33537 (diff) | |
download | tcl-2454e655e137710903fe501014aa0de7550297cc.zip tcl-2454e655e137710903fe501014aa0de7550297cc.tar.gz tcl-2454e655e137710903fe501014aa0de7550297cc.tar.bz2 |
Undone part of change [32d93a8414], keeping [chan postevent] synchronous for owner == handler.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclIORChan.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 76002f6..2d31da3 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -934,7 +934,9 @@ TclChanPostEventObjCmd( * We have the channel and the events to post. */ - { + if (rcPtr->owner == rcPtr->thread) { + Tcl_NotifyChannel (chan, events); + } else { ReflectEvent* ev = ckalloc (sizeof (ReflectEvent)); ev->header.proc = ReflectEventRun; ev->events = events; @@ -947,24 +949,21 @@ TclChanPostEventObjCmd( * event is run may generate a situation where the channel structure * is deleted but not our structure, crashing in * FreeReflectedChannel(). + * + * Force creation of the RCM, for proper cleanup on thread teardown. + * The teardown of unprocessed events is currently coupled to the + * thread reflected channel map */ - - /* Force creation of the RCM, for proper cleanup on thread teardown */ - /* The teardown of unprocessed events is currently coupled to the thread reflected channel map */ (void) GetThreadReflectedChannelMap (); - if (rcPtr->owner == rcPtr->thread) { - Tcl_QueueEvent ((Tcl_Event*) ev, TCL_QUEUE_TAIL); - } else { - /* XXX Race condition !! - * XXX The destination thread may not exist anymore already. - * XXX (Delayed postevent executed after channel got removed). - * XXX Can we detect this ? (check the validity of the owner threadid ?) - * XXX Actually, in that case the channel should be dead also ! - */ - Tcl_ThreadQueueEvent (rcPtr->owner, (Tcl_Event*) ev, TCL_QUEUE_TAIL); - Tcl_ThreadAlert (rcPtr->owner); - } + /* XXX Race condition !! + * XXX The destination thread may not exist anymore already. + * XXX (Delayed postevent executed after channel got removed). + * XXX Can we detect this ? (check the validity of the owner threadid ?) + * XXX Actually, in that case the channel should be dead also ! + */ + Tcl_ThreadQueueEvent (rcPtr->owner, (Tcl_Event*) ev, TCL_QUEUE_TAIL); + Tcl_ThreadAlert (rcPtr->owner); } /* |