The purpose of this page is to catalog [Tcl] [extension]s believed to be safe for use in multi-threaded [Tcl application]s, along with the version numbers in which [thread-safety] was added. This list might change as the definition of "thread-safe" evolves in the Tcl community. It is important to note that pure Tcl libraries (such as anything in [tcllib]) is thread-safe. However, one should be careful when using certain libraries in tcllib that may require external libraries optionally for [speed] (such as [md5]). These should perhaps be checked to either not use the [external library] when built threaded, or verify that the external library is thread-safe. Even though a [library] may be listed as "thread-safe" here, it is likely necessary to ensure that the library was built with -D[TCL_THREADS] (usually with ./configure --[enable-threads]). * [incr Tcl] 3.2.1 * [Metakit] 2.4.0 * [Oratcl] 4.0 * [tDOM] 0.7.5 * [XOTcl] 0.9.4 * [TclBridge] 1.8.1.3848 * [tclvfs] 1.0 * [cgraph] 0.4 ---- Current versions of [Tclx] appear '''NOT''' to be thread-safe. In fact, the tclx readdir comand fails to return valid values whether or not tclx was compiled with the threads configuration activated. ---- Here is a list of thread-safe and not-safe libraries, at the bottom of the page. http://httpd.apache.org/docs-2.0/developer/thread_safety.html ---- Well, let me be the first to define "thread-safe": thread safe code does not fail with a segfault two times, then once with a bus error, then run for a week followed by a hardware lockup. -PSE ---- [UKo] If an extension is not (known) threadsafe, is it safe to use it in only one thread? [RFox] Maybe... maybe not. Depends on why it's not thread safe. [Duoas] UKo, you'll have to do some reading on '''threads''' and '''processes'''. Tcl has a very process-like thread model and a lot of nice thread synchronization automatically at work. The problem is, an extension provides its own data core. Imagine two or three threads all calling one of an extension's routines which directly manipulates its extension data. The routine in thread one modifies variable 1, thread two modifies variable two, thread one uses the (now potentially invalid) variable 1, thread three sticks its thumb in... etc. So, if you can absolutely guarantee that only one thread uses an extension, then yes, you can use it. However, making that guarantee might be a bit more difficult than it would seem at first blush. For example, how do you use '''incr Tcl''' in only one thread? ---- [Category Threads]