fix with_mutex in uni-threaded case.
avoid dynamics for stable data.
This commit is contained in:
parent
8872fed811
commit
57ca6f6406
@ -39,7 +39,6 @@ volatile(P) :-
|
||||
|
||||
'$do_volatile'(P,M) :- dynamic(M:P).
|
||||
|
||||
|
||||
:- initialization('$init_thread0').
|
||||
|
||||
'$init_thread0' :-
|
||||
@ -51,7 +50,7 @@ volatile(P) :-
|
||||
recorda('$thread_defaults', [0, 0, 0, false, true], _),
|
||||
'$create_thread_mq'(0),
|
||||
'$new_mutex'(Id),
|
||||
assert('$with_mutex_mutex'(Id)).
|
||||
assert_static(prolog:'$with_mutex_mutex'(Id)).
|
||||
|
||||
'$top_thread_goal'(G, Detached) :-
|
||||
'$thread_self'(Id),
|
||||
@ -503,6 +502,9 @@ mutex_unlock_all :-
|
||||
'$unlock_mutex'(Id),
|
||||
'$mutex_unlock_all'(Id).
|
||||
|
||||
with_mutex(M, G) :-
|
||||
'$no_threads', !,
|
||||
call(G).
|
||||
with_mutex(M, G) :-
|
||||
var(M), !,
|
||||
'$do_error'(instantiation_error,with_mutex(M, G)).
|
||||
|
Reference in New Issue
Block a user