Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
33
Task/Mutex/Logtalk/mutex.logtalk
Normal file
33
Task/Mutex/Logtalk/mutex.logtalk
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
:- object(slow_print).
|
||||
|
||||
:- threaded.
|
||||
|
||||
:- public(start/0).
|
||||
|
||||
:- private([slow_print_abc/0, slow_print_123/0]).
|
||||
:- synchronized([slow_print_abc/0, slow_print_123/0]).
|
||||
|
||||
start :-
|
||||
% launch two threads, running never ending goals
|
||||
threaded((
|
||||
repeat_abc,
|
||||
repeat_123
|
||||
)).
|
||||
|
||||
repeat_abc :-
|
||||
repeat, slow_print_abc, fail.
|
||||
|
||||
repeat_123 :-
|
||||
repeat, slow_print_123, fail.
|
||||
|
||||
slow_print_abc :-
|
||||
write(a), thread_sleep(0.2),
|
||||
write(b), thread_sleep(0.2),
|
||||
write(c), nl.
|
||||
|
||||
slow_print_123 :-
|
||||
write(1), thread_sleep(0.2),
|
||||
write(2), thread_sleep(0.2),
|
||||
write(3), nl.
|
||||
|
||||
:- end_object.
|
||||
Loading…
Add table
Add a link
Reference in a new issue