OriginalBugID: 5758 Bug
Version: 8.2.3
SubmitDate: '2000-05-31'
LastModified: '2000-07-25'
Severity: MED
Status: Assigned
Submitter: techsupp
ChangedBy: davidg
RelatedBugIDs: 5791
OS: Solaris
OSVersion: SunOS 5.6 Generic_105181-16
Machine: sun4u sparc
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'
Name:
Ben Vitale
Extensions:
Tclx 8.2
Comments:
this patch is only a start. it won't work if there aren't any fileevent
handlers registered, because 'waitingList' will
be empty. Also, TclX is quite clear the 'the first interp to check
Tcl_AsyncReady' will run all the handlers. I'm
OK with this, I guess, but the callback script might fail if it
consisted of 'foo' and proc foo {} was defined in one
interp, but not the interp running the handler.
ideally TclX could inform the notifier which interps were interested in
which signals (at most one interp, say,
the last one to register a given signal, could handle a given signal).
A data structure looking something like
Tcl_Interp *signal_interps [SIGMAX];
might help. This could be used by the notifier to know that each of
these interps should be added to the waiting
list. And it could be used by Tcl X so that a given signal runs in the
right interp.
is there any effort to use sigprocmask to ensure that only the notifier
thread gets signals?
ReproducibleScript:
#!./tclsh
package require Tclx
proc foo {} {
puts "bye"
exit
}
# even with my patch, if you take out this line, things break
set s [socket -server {puts foo} 0]
signal trap INT {foo}
vwait forever
# run this script from a shell. type ^C or run kill -INT etc.
ObservedBehavior:
^C does not interrupt the script, or stop it, or run the proc foo{} etc.
DesiredBehavior:
when the process running the script gets SIGINT, it should run my signal handler, proc foo{}
Patch:
--- tclUnixNotfy.c 2000/01/26 19:14:13 1.1.1.2
+++ tclUnixNotfy.c 2000/05/27 06:46:33 1.2
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixNotfy.c,v 1.1.1.2 2000/01/26 19:14:13 ben Exp $
+ * RCS: @(#) $Id: tclUnixNotfy.c,v 1.2 2000/05/27 06:46:33 ben Exp $
*/
#include "tclInt.h"
@@ -897,6 +897,8 @@
*/
while (1) {
+ int async_ready = 0;
+
/*
* Set up the select mask to include the receive pipe.
*/
@@ -941,6 +943,9 @@
* Try again immediately on an error.
*/
+ if (errno == EINTR && Tcl_AsyncReady ())
+ async_ready = 1;
+ else
continue;
}
@@ -957,7 +962,8 @@
found |= word;
(((long*)(tsdPtr->readyMasks))[i]) = word;
}
- if (found || (tsdPtr->pollState & POLL_DONE)) {
+ if (found || (tsdPtr->pollState & POLL_DONE) || async_ready) {
+ async_ready = 0;
tsdPtr->eventReady = 1;
Tcl_ConditionNotify(&tsdPtr->waitCV);
if (tsdPtr->onList) {
PatchFiles:
tclUnixNotfy.c
TR#5791 might be related to this. generic/tclAsync.c is very broken under threads already and it might be better to fix it first.
-- 07/19/2000 davidg
tclAsync.c is now fixed in the mainline CVS code. Is TclX built against this working properly now?
-- 07/25/2000 davidg
|