xcall
Previous: writedevice
Next: BAP Online Manuals
6.2.141. xcall
calls its argument as a goal on a separate process
SYNOPSIS
INCLUDE 'sysman.h' xcall(Goal)
SYNTAX
xcall(Goal) (i) xcall(ServerID,Goal) (i,i)
ARGUMENTS
void(Goal) (i) Goal to be called
server(ServerID) Process on which Goal is called
DESCRIPTION
A server is allocated if ServerID is only partially initialised, unbound, or not provided. The
Goal is called on that server, and the current process is suspended until the first solution is
found. This solution will be matched with the Goal. While the calling process evaluates the first
solutions, the other process continues to satisfy the goal as if backtracking has already occurred.
When the goal finally fails or succeeds, the process is returned to the public server pool.
This predicate allows you to create easily multitasking applications from existing programs.
Please consult the Language Tutorial for a detailed description.
NOTE: xcall() uses the call () predicate,
thus the same restrictions apply!
IMPORTANT NOTE: Cutting backtracking over an xcall() may result in unpredictable results in
the version of BAP.
EXAMPLE
xcall( Generate(X)), test(X), write(X),nl, fail.
ERRORS
No runtime errors. If a server is to be allocated, the process might suspend if no
server is available.
This may cause deadlocks!
LAYERS
client-server
RELATED PREDICATES
alloc_server , call , exec , dcall , send_msg , rec_msg
BAP Online Manuals : Library Reference : Library by Name : xcall
Previous: writedevice
Next: BAP Online Manuals