Version 12 of thread

Updated 2004-12-29 12:36:13

Purpose: document the Tcl thread extension, point to its online source code repository, etc.

 What: Thread extension
 Where: http://tcl.sf.net/ 
 Description: This Tcl extension, with a thread-enabled core, allows script
        level access to run Tcl scripts within threads.
        Currently at version 2.6 .
 Updated: 12/2004
 Contact: See web site

See also Threads


As of early 2004, the best documentation for the Thread extension appears in "The Tcl Threading Model" [L1 ], the Thread "man" page [L2 ], and a sample chapter [L3 ] from Brent's (et al.) book. dqkit is a convenient deployment for those with an interest in

  package require Thread

People with an interest in this extension might also want to subscribe to the tcl-threads mailing list [L4 ] on SourceForge.


A distinct meaning [L5 ] of "thread" occurs in discussions of bytecode, especially when Forth is nearby.


The 2.6 release adds a sub-package called Ttrace. This allows for easy propagation of interpreter related resources (procedures, namespaces, objects (for XOTcl)). Usage is trivial: yust wrap the code you want to replicate within ttrace::eval like this:

    package req Thread
    package req Ttrace

    for {set i 0} {$i < 4} {incr i} {
        set tid($i) [thread::create -preserved]
    }

    ttrace::eval {
        proc foo {args} {
           puts foo
        }
        proc bar {args} {
           puts bar
        }
    }

and execute this from any thread created by the thread extension. This will replicate the definitions of 'foo' and 'bar' to all existing threads. In the above example, all 4 threads will be seeded. For more information see 'man ttrace'.


[ Category Package | Category Threads ]