diff options
author | andreask <andreask> | 2012-05-09 22:28:42 (GMT) |
---|---|---|
committer | andreask <andreask> | 2012-05-09 22:28:42 (GMT) |
commit | d7b37fbb9438a6afef67cab2e2c8c27611ee43d2 (patch) | |
tree | 10a287ec5db41cc48ec30c89bdee41e5db5d4bd9 /generic | |
parent | 77fc0e1330207148cd7a2e3c27a788ad2fed3cb0 (diff) | |
download | tcl-d7b37fbb9438a6afef67cab2e2c8c27611ee43d2.zip tcl-d7b37fbb9438a6afef67cab2e2c8c27611ee43d2.tar.gz tcl-d7b37fbb9438a6afef67cab2e2c8c27611ee43d2.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); } /* |