Fifth Annual Tcl/Tk Workshop, 1997
PtTcl: Using Tcl with Pthreads
D. Richard Hipp, Hwaci, Charlotte, NC
Mike Cruse, CTI, Ltd., Prescott, AZ
Abstract
Tcl is not thread-safe.
If two or more threads attempt to use Tcl at the same time,
internal data structures can be corrupted and the program can crash.
This is true even if the threads are using separate Tcl interpreters.
PtTcl is a modification to the Tcl core that makes Tcl safe to
use with POSIX threads.
With PtTcl, each thread can create and use its own Tcl interpreters
that will not interfere with interpreters used in other threads.
A message-passing mechanism allows Tcl interpreters running in
different treads to communicate.
However, even with PtTcl, the same interpreter still cannot be accessed
by more than one thread.
This paper describes the design, implementation and use of PtTcl.
|