summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--generic/tclIORChan.c31
-rw-r--r--tests/ioCmd.test2
2 files changed, 16 insertions, 17 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);
}
/*
diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index fc47bbf..cf913ff 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -2614,7 +2614,7 @@ test iocmd.tf-24.16 {chan write, note the background flush setup by close due to
rename foo {}
unset res
} -result {{write rc* ABC} {watch rc* write} {} BG {write rc* ABC}} \
- -constraints {testchannel thread knownBug}
+ -constraints {testchannel thread}
test iocmd.tf-24.17.bug3522560 {postevent for transfered channel} \
-constraints {testchannel thread} -setup {