On 01.10.2007, at 21:04, Tom Jackson wrote:

tclsock.c-766-    /*
tclsock.c-767- * Pass a dup of the socket to the callback thread, allowing tclsock.c-768- * this thread's cleanup to close the current socket. It's tclsock.c-769- * not possible to simply register the channel again with tclsock.c-770- * a NULL interp because the Tcl channel code is not entirely
tclsock.c:771:     * thread safe.
tclsock.c-772-     */
tclsock.c-773-
tclsock.c-774-    sock = ns_sockdup(sock);

...

tclsock.c-1077- if (cbPtr->chan == NULL) {
tclsock.c-1078-     /*
tclsock.c-1079- * Create and register the channel on first use. Because tclsock.c:1080: * the Tcl channel code is not entirely thread safe, it's tclsock.c-1081- * not possible for the scheduling thread to create and
tclsock.c-1082-      * register the channel.
tclsock.c-1083-      */
tclsock.c-1084-
tclsock.c-1085- cbPtr->chan = Tcl_MakeTcpClientChannel ((ClientData) sock);


This is all old stuff as since some time the Tcl channel
handling code is thread-safe and you can create channels
in one, de-register them and register them again in the
other thread.

Beside that, the patch that Gustaf added is neutral in the sense
what usage people will make out of it. It merely allows you to
re-use the connection socket from your Tcl code w/o the need to
add yet-another ns_return-like of command. You can use this for a
variety of purposes, not necessarily only for implementing a
single-thread-static-content server.
It is safe to use with [ns_channel] machinery as well...

Cheers,
Zoran


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to