Multithreaded applications

Even though Tcl is designed to work efficiently in a single-threaded environment, it is possible to create separate threads in Tcl. While it can be used for performing any action, it is usually used for operations that take a lot of time to complete.

Threads in Tcl require that Tcl is built with threading enabled and has the package Thread installed, which is true for all ActiveTcl installations. Tcl builds from various operating system distributions may or may not be built with thread support enabled—in this case, the Thread package may not be present.

Managing threads

Tcl uses that approach that each thread is a separate entity and data is not normally shared across threads. It is possible to send commands to be evaluated ...

Get Tcl 8.5 Network Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.