I have a large(ish) Tcl/Tk program that is mouse driven.
(I am using Tcl7.5, Tk4.1, Solaris2)
I wish to extend the program so that is can be driven by commands
arriving on a UNIX socket. This must happen concurrently with
mouse control.
I guess that I will call fork() to create a child process. This
child process will block awaiting input from the socket. When
input arrives, the child will interpret it and call the apropriate
procedure in the Tcl/Tk script. When the Tcl procedure completes,
it will return to the child C code which will block on the socket
again, awaiting the next input. All this must happen concurrently
and independantly of user-driven mouse control.
I have thought of two possible solutions, but am not happy with
either:
1. I could have the child process run as a self contained,
separate Tcl application, and use the Tcl send command to invoke
the appropriate procedures in the parent Tcl application. I do
not want to do this as I guess it would be inefficient.
2. I could make the child process provide a "new event source", as
described in the Tcl_CreateEventSource manual page (no need for
two processes if this method is used?). I am not keen on this
approach as it will involve much hacking about of Tcl itself which
I guess will be difficult.
If anybody can suggest a simpler/cleaner/more efficient way of
solving my problem than the above please let me know.
Thanks in advance,
Sam Harrison.
S.Har...@aivru.shef.ac.ukA.I. Vision Research Unit, Sheffield University