Re: [tkined] callbacks

Juergen Schoenwaelder (schoenw@ibr.cs.tu-bs.de)
Mon, 6 Dec 1999 17:18:48 +0100

>>>>> Eddie Corns writes:

[...]

Eddie> $snconn($host) get $oind "proc_poll $host $sqconn %E {%V}"

[...]

Eddie> I don't know anything about how these callbacks get called so
Eddie> my main question is - can I be sure that whilst processing one
Eddie> callback I will never be asked to process another, which would
Eddie> cause my output to be interleaved?

Yes.

(Newer Tcl versions support multiple interpreters executing in
multiple threads in one process. However, as long as you do not use
threads, callbacks will be processed sequentially. And even if you
were using threads, you will have sequential callbacks within an
interpreter. Note, the current Tnm version is not yet thread-safe.)

Eddie> Another question is whether there is a limit (other than
Eddie> memory) to how many outstanding asynchronous requests I can
Eddie> have (I assume not since presumably there are no file
Eddie> descriptors or such like?)?

I do not know such a limit. Command generator sessions share the
underlying socket and all the internal data structures are dynamic.

Eddie> Finally, a minor point, in order to keep TCL happy I need to
Eddie> pass the correct number of arguments but sometimes %V (possibly
Eddie> others?) is empty, this is why I have {%V} above, it would be
Eddie> nice to substitute, say {}, instead of an empty string if this
Eddie> didn't break anything else.

The % substitutions (which I borrowed from Tk) turned out to be a bad
idea. Despite the problem you describe above, % substitutions lead to
inefficient code since callback will be recompiled everytime and there
is a non-trivial risk to introduce bugs by having substitutions in
strings like "%V" (suppose %V contains valid Tcl code).

My conclusion is therefore to actually drop % substitutions in a
future release and to pass (at maximum) a single handle which you can
query for the event details. However, this is not going to happen
today or tomorrow. Your suggestion to expland %V to an empty list
looks interesting - but it only cures part of the problem.

/js

-- 
Juergen Schoenwaelder      Technical University Braunschweig
<schoenw@ibr.cs.tu-bs.de>  Dept. Operating Systems & Computer Networks
Phone: +49 531 391 3289    Bueltenweg 74/75, 38106 Braunschweig, Germany
Fax:   +49 531 391 5936    <URL:http://www.ibr.cs.tu-bs.de/~schoenw/>

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.