Thread communication¶
Prolog threads can exchange data using dynamic predicates, database records, and other globally shared data.
These provide no suitable means to wait for data or a condition as they can only be checked in an expensive polling loop. Message queues provide a means for threads to wait for data or conditions without using the CPU.
Each thread has a message-queue attached to it that is identified by the thread. Additional queues are created using message_queue_create//22
.