summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorandreask <andreask>2012-05-09 22:28:42 (GMT)
committerandreask <andreask>2012-05-09 22:28:42 (GMT)
commit2454e655e137710903fe501014aa0de7550297cc (patch)
tree10a287ec5db41cc48ec30c89bdee41e5db5d4bd9 /generic
parente20f1abdc32a0550e6c840dcb99c848b39d33537 (diff)
downloadtcl-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.c31
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);
}
/*