thread_get_message/1

thread_get_message(? Term)*

Examines the thread message-queue and if necessary blocks execution until a term that unifies to Term arrives in the queue. After a term from the queue has been unified unified to Term, the term is deleted from the queue and this predicate returns.

Please note that not-unifying messages remain in the queue. After the following has been executed, thread 1 has the term gnu in its queue and continues execution using A is gnat.


 <thread 1>
 thread_get_message(a(A)),

 <thread 2>
 thread_send_message(b(gnu)),
 thread_send_message(a(gnat)),

See also thread_peek_message//11.