diff --git a/docs/yap.tex b/docs/yap.tex index eb81cce69..90e700d98 100644 --- a/docs/yap.tex +++ b/docs/yap.tex @@ -10153,6 +10153,12 @@ wait for the mutex. The collistion-count is not available on Windows as this would break portability to Windows-95/98/ME or significantly harm performance. Generally collision count is close to zero on single-CPU hardware. + +@item threads +@findex threads/0 +@snindex threads/0 +@cnindex threads/0 +Prints a table of current threads and their status. @end table diff --git a/pl/threads.yap b/pl/threads.yap index b71fca184..adad8ae58 100644 --- a/pl/threads.yap +++ b/pl/threads.yap @@ -479,7 +479,6 @@ thread_local(X) :- '$do_error'(type_error(callable,X),thread_local(Mod:X)). - thread_sleep(Time) :- var(Time), !, '$do_error'(instantiation_error,thread_sleep(Time)). @@ -521,3 +520,14 @@ thread_signal(Thread, Goal) :- '$thread_self'(Id), recorded('$thread_signal',[Id|G],R), erase(R). + + +threads :- + write('--------------------------------------------------------------'), nl, + format("~t~a~38+~n", 'Thread Status'), + write('--------------------------------------------------------------'), nl, + current_thread(Thread, Status), + format("~t~q~30+ ~q~n", [Thread, Status]), + fail. +threads :- + write('--------------------------------------------------------------'), nl.