tests if a message is contained in the message box
INCLUDE 'msglib.h' query_msg(SenderID,done)
server(ServerID) (x) ID of the message sender
char(Term) (x) Term to be tested.
This may be used to check if certain messages have arrived. The predicate fails
immediately if no message is matching the input terms. If a Term from a specific process
identified by ServerID is found, the predicate matches it with its input terms and succeeds,
for each matching messages once. The messages are NOT removed from the mail
NOTE: Polling message ports is NOT the usual way to program in a multitasking environment. So the example below is something you should avoid!
repeat, ( query_msg(Sender,done),! ; write("Still not done"),nl,fail ), rec_msg(Sender,done).
No runtime errors.
prolog-process, client-server, object
rec_msg , send_msg