BAP Online Manuals : Library Reference : Library by Name : exec
Previous: error
Next: exists

6.2.46. exec

executes the specified goal on a remote process

SYNOPSIS

INCLUDE 'sysman.h'
exec(Goal)

alloc_server(ServerID),
exec(ServerID,Goal)

SYNTAX

exec(Goal) (i)
exec(ServerID,Goal) (i,i)

ARGUMENTS

void(Goal) (i) Goal to be executed
server(ServerID) Process on which Goal is executed

DESCRIPTION

A server is allocated if ServerID is only partially initialised, unbound, or not provided. The Goal is called on that server, but no results are returned. When the goal finally fails, the process is returned to the public server pool. To receive results, you have to use the send_msg (), rec_msg () predicates.
This predicate allows you to create any asynchronous communication scheme. Please consult the Language Tutorial for a detailed description.
NOTE: exec uses the call () predicate, thus the same restrictions apply!

EXAMPLE

get_my_id(MyID),
exec(Server,( something(Results), send_msg(MyID,Results))),
something_else,
rec_msg(Server,Answer).

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 , xcall , dcall , send_msg , rec_msg


BAP Online Manuals : Library Reference : Library by Name : exec
Previous: error
Next: exists