built-in predicate

threaded_wait/1

Description

threaded_wait(Term)
threaded_wait([Term| Terms])

Suspends the thread making the call until a notification is received that unifies with Term. The call must be made within the same object (this) containing the calls to the threaded_notify/1 predicate that will eventually send the notification. The argument may also be a list of notifications, [Term| Terms]. In this case, the thread making the call will suspend until all notifications in the list are received.

Note

This predicate requires a backend Prolog compiler providing compatible multi-threading primitives. The value of the read-only threads flag is set to supported when that is the case.

Modes and number of proofs

threaded_wait(?term) - one
threaded_wait(+list(term)) - one

Errors

(none)

Examples

% wait until the "data_available" notification is received:
..., threaded_wait(data_available), ...