next up previous contents index
Next: Status of the thread Up: Multi-threading (alpha code) Previous: Thread synchronisation   Contents   Index

Thread-support library(threadutil)

This library defines a couple of useful predicates for demonstrating and debugging multi-threaded applications. This library is certainly not complete.

threads0 Lists all current threads and their status. In addition, all `zombie' threads (finished threads that are not detached, nor waited for) are joined to reclaim their resources. interactor0 Create a new console and run the Prolog toplevel in this new console. See also attach_console0. attach_console0 If the current thread has no console attached yet, attach one and redirect the user streams (input, output, and error) to the new console window. The console is an xterm application. For this to work, you should be running X-windows and your xterm should know the -Sccn.

This predicate has a couple of useful applications. One is to separate (debugging) I/O of different threads. Another is to start debugging a thread that is running in the background. If thread 10 is running, the following sequence starts the tracer on this thread:


\begin{code}
?- thread_signal(10, (attach_console, trace)).
\end{code}


next up previous contents index
Next: Status of the thread Up: Multi-threading (alpha code) Previous: Thread synchronisation   Contents   Index
Dr. Richard Botting 2001-12-12