The clients are one or more SICStus processes that have connection(s) to the server.
To load the package, enter the query
| ?- use_module(library('linda/client')).
Some of the following predicates fail if they don't receive an
answer from the Linda-server in a reasonable amount of time. That time
is set with the predicate linda_timeout/2
.
linda_client(
+Address)
linda/[0,1]
.
It is not possible to be connected to two Linda-servers at the same time.
This predicate can fail due to a timeout.
close_client
shutdown_server/0
shutdown_server/0
returns. The server continues
running after receiving this signal, processing requests from existing
clients, until such time as all
the clients have closed their connections. It is up to the clients to
tell each other to quit. When all the clients are done, the server stops
(i.e. linda/[0,1]
succeeds). Courtesy of Malcolm Ryan.
Note that close_client/0
should be called after
shutdown_server/0
. shutdown_server/0
will raise an error
if there is no connection between the client and the server.
The behavior of shutdown_server/0
changed in SICStus Prolog
4.2. In previous releases the server continued to accept new connections
after being told to shutdown. Now it immediately stops listening for new
connections and releases the listening socket and these server actions
happens before the client returns from shutdown_server/0
.
linda_timeout(
?OldTime,
?NewTime)
off
or of the form
Seconds:Milliseconds. The former value indicates that the timeout
mechanism is disabled, that is, eternal waiting. The latter form is the
timeout-time.
out(
+Tuple)
in(
?Tuple)
out/1
).
in_noblock(
?Tuple)
This predicate can fail due to a timeout.
in(
+TupleList,
?Tuple)
in/1
but succeeds when either of the tuples in TupleList
is available. Tuple is unified with the fetched tuple. If
that unification fails, the tuple is not reinserted in the
tuple-space.
rd(
?Tuple)
in/1
: the tuple is not removed.
rd_noblock(
?Tuple)
This predicate can fail due to a timeout.
rd(
+TupleList,
?Tuple)
in/2
but does not remove any tuples.
bagof_rd_noblock(
?Template,
+Tuple,
?Bag)
The behavior of variables in Tuple and Template is as
in bagof/3
. The variables could be existentially
quantified with ^/2
as in bagof/3
.
The operation is performed as an atomic operation.
This predicate can fail due to a timeout.
Example: Assume that only one client is connected to the server and that the tuple-space initially is empty.
| ?- out(x(a,3)), out(x(a,4)), out(x(b,3)), out(x(c,3)). | ?- bagof_rd_noblock(C-N, x(C,N), L). C = _32, L = [a-3,a-4,b-3,c-3], N = _52 | ?- bagof_rd_noblock(C, N^x(C,N), L). C = _32, L = [a,a,b,c], N = _48