query_msg
BAP Online Manuals : Library
Reference : Library by Name
: query_msg
Previous: put
Next: random
BAP Online Manuals : Library Reference : Library by Name : query_msg
Previous: put
Next: random
Previous: put
Next: random
6.2.99. query_msg
tests if a message is contained in the message box
SYNOPSIS
INCLUDE 'msglib.h' query_msg(SenderID,done)
SYNTAX
query_msg(SenderID,Term) (i)
ARGUMENTS
server(ServerID) (x) ID of the message sender
char(Term) (x) Term to be tested.
DESCRIPTION
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
box.
NOTE: Polling message ports is NOT the usual way to program in a multitasking
environment. So the example below is something you should avoid!
EXAMPLE
repeat, ( query_msg(Sender,done),! ; write("Still not done"),nl,fail ), rec_msg(Sender,done).
ERRORS
No runtime errors.
LAYERS
prolog-process, client-server, object
RELATED PREDICATES
BAP Online Manuals : Library Reference : Library by Name : query_msg
Previous: put
Next: random