fix mutex creation

This commit is contained in:
Vítor Santos Costa 2014-11-26 09:46:44 +00:00
parent 6d82d4816a
commit 570513f8f9

View File

@ -878,12 +878,6 @@ There is no limit to the number of mutexes that can be created.
*/ */
mutex_create(Mutex) :-
( atom(Mutex) ->
mutex_create(_, [alias(Mutex)])
; mutex_create(Mutex, [])
).
mutex_create(Id, Options) :- mutex_create(Id, Options) :-
nonvar(Id), !, nonvar(Id), !,
'$do_error'(uninstantiation_error(Id), mutex_create(Id, Options)). '$do_error'(uninstantiation_error(Id), mutex_create(Id, Options)).
@ -891,13 +885,8 @@ mutex_create(Id, Options) :-
Goal = mutex_create(Id, Options), Goal = mutex_create(Id, Options),
'$mutex_options'(Options, Alias, Goal), '$mutex_options'(Options, Alias, Goal),
( atom(Alias) -> ( atom(Alias) ->
( recorded('$mutex_alias',[_| Alias], _) -> mutex_create(Alias)
'$do_error'(permission_error(create, mutex, Alias), Goal) ; mutex_create(Id)
; '$new_mutex'(Id),
recorda('$mutex_alias', [Id| Alias], _)
)
; '$new_mutex'(Id),
recorda('$mutex_alias', [Id| Id], _)
). ).
'$mutex_options'(Var, _, Goal) :- '$mutex_options'(Var, _, Goal) :-