Fix: bad implementation of with_mutex/2
This commit is contained in:
parent
21fe137d27
commit
37e8fcc353
@ -1018,7 +1018,7 @@ source_file_property( File0, Prop) :-
|
|||||||
'$source_file_property'( File, Prop).
|
'$source_file_property'( File, Prop).
|
||||||
|
|
||||||
'$source_file_property'( OldF, includes(F, Age)) :-
|
'$source_file_property'( OldF, includes(F, Age)) :-
|
||||||
recorded('$lf_loaded','$lf_loaded'( F, _M, _ include, _File, OldF, _Line, _), _),
|
recorded('$lf_loaded','$lf_loaded'( F, _M, include, _File, OldF, _Line, _), _),
|
||||||
recorded('$lf_loaded','$lf_loaded'( F, Age, _), _).
|
recorded('$lf_loaded','$lf_loaded'( F, Age, _), _).
|
||||||
'$source_file_property'( F, included_in(OldF, Line)) :-
|
'$source_file_property'( F, included_in(OldF, Line)) :-
|
||||||
recorded('$lf_loaded','$lf_loaded'( F, _M, include, _File, OldF, Line, _), _).
|
recorded('$lf_loaded','$lf_loaded'( F, _M, include, _File, OldF, Line, _), _).
|
||||||
|
@ -564,19 +564,19 @@ mutex_unlock_all :-
|
|||||||
'$mutex_unlock_all'(Id).
|
'$mutex_unlock_all'(Id).
|
||||||
|
|
||||||
with_mutex(M, G) :-
|
with_mutex(M, G) :-
|
||||||
'$no_threads', !,
|
( '$no_threads' ->
|
||||||
call(G).
|
once(G)
|
||||||
with_mutex(M, G) :-
|
;
|
||||||
var(M), !,
|
var(M) ->
|
||||||
'$do_error'(instantiation_error,with_mutex(M, G)).
|
'$do_error'(instantiation_error,with_mutex(M, G))
|
||||||
with_mutex(M, G) :-
|
;
|
||||||
var(G), !,
|
var(G) ->
|
||||||
'$do_error'(instantiation_error,with_mutex(M, G)).
|
'$do_error'(instantiation_error,with_mutex(M, G))
|
||||||
with_mutex(M, G) :-
|
;
|
||||||
\+ callable(G), !,
|
\+ callable(G) ->
|
||||||
'$do_error'(type_error(callable,G),with_mutex(M, G)).
|
'$do_error'(type_error(callable,G),with_mutex(M, G))
|
||||||
with_mutex(M, G) :-
|
;
|
||||||
atom(M), !,
|
atom(M) ->
|
||||||
'$with_mutex_mutex'(WMId),
|
'$with_mutex_mutex'(WMId),
|
||||||
'$lock_mutex'(WMId),
|
'$lock_mutex'(WMId),
|
||||||
( recorded('$mutex_alias',[Id|M],_) ->
|
( recorded('$mutex_alias',[Id|M],_) ->
|
||||||
@ -584,15 +584,16 @@ with_mutex(M, G) :-
|
|||||||
; '$new_mutex'(Id),
|
; '$new_mutex'(Id),
|
||||||
recorda('$mutex_alias',[Id|M],_)
|
recorda('$mutex_alias',[Id|M],_)
|
||||||
),
|
),
|
||||||
'$lock_mutex'(Id),
|
|
||||||
'$unlock_mutex'(WMId),
|
'$unlock_mutex'(WMId),
|
||||||
|
'$lock_mutex'(Id),
|
||||||
( catch('$execute'(G), E, ('$unlock_mutex'(Id), throw(E))) ->
|
( catch('$execute'(G), E, ('$unlock_mutex'(Id), throw(E))) ->
|
||||||
'$unlock_mutex'(Id)
|
'$unlock_mutex'(Id)
|
||||||
; '$unlock_mutex'(Id),
|
; '$unlock_mutex'(Id),
|
||||||
fail
|
fail
|
||||||
|
)
|
||||||
|
;
|
||||||
|
'$do_error'(type_error(atom,M),with_mutex(M, G))
|
||||||
).
|
).
|
||||||
with_mutex(M, G) :-
|
|
||||||
'$do_error'(type_error(atom,M),with_mutex(M, G)).
|
|
||||||
|
|
||||||
current_mutex(M, T, NRefs) :-
|
current_mutex(M, T, NRefs) :-
|
||||||
recorded('$mutex_alias',[Id|M],_),
|
recorded('$mutex_alias',[Id|M],_),
|
||||||
|
Reference in New Issue
Block a user