Logtalk reference manual
Predicate directive: synchronized/1

synchronized/1

Description

synchronized(Functor/Arity)
synchronized(Functor1/Arity1, Functor2/Arity2, ...)
synchronized([Functor1/Arity1, Functor2/Arity2, ...])

synchronized(Functor//Arity)
synchronized(Functor1//Arity1, Functor2//Arity2, ...)
synchronized([Functor1//Arity1, Functor2//Arity2, ...])

Declares synchronized predicates and synchronized grammar rule non-terminals. A synchronized predicate (or synchronized non-terminal) is protected by a mutex in order to allow for thread synchronization when proving a call to the predicate (or non-terminal). All predicates declared in the same synchronized directive share the same mutex. In order to use a separate mutex for each predicate (so that they are independently synchronized), a per-predicate synchronized directive must be used.

Template and modes

synchronized(+predicate_indicator_term)
synchronized(+non_terminal_indicator_term)

Examples

:- synchronized(db_update/1).

:- synchronized(write_stream/2, read_stream/2).

:- synchronized([add_to_queue/2, remove_from_queue/2]).