Added a new multi-threading predicate, threads/0, which prints a nicely formatted table of current threads and their status. Similar to the predicate with the same name on SWI-Prolog except that it does not join terminated threads.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1658 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
ccc1bc0f3c
commit
326c64ff2c
@ -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
|
Windows as this would break portability to Windows-95/98/ME or
|
||||||
significantly harm performance. Generally collision count is
|
significantly harm performance. Generally collision count is
|
||||||
close to zero on single-CPU hardware.
|
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
|
@end table
|
||||||
|
|
||||||
|
|
||||||
|
@ -479,7 +479,6 @@ thread_local(X) :-
|
|||||||
'$do_error'(type_error(callable,X),thread_local(Mod:X)).
|
'$do_error'(type_error(callable,X),thread_local(Mod:X)).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
thread_sleep(Time) :-
|
thread_sleep(Time) :-
|
||||||
var(Time), !,
|
var(Time), !,
|
||||||
'$do_error'(instantiation_error,thread_sleep(Time)).
|
'$do_error'(instantiation_error,thread_sleep(Time)).
|
||||||
@ -521,3 +520,14 @@ thread_signal(Thread, Goal) :-
|
|||||||
'$thread_self'(Id),
|
'$thread_self'(Id),
|
||||||
recorded('$thread_signal',[Id|G],R),
|
recorded('$thread_signal',[Id|G],R),
|
||||||
erase(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.
|
||||||
|
Reference in New Issue
Block a user