std.actor.gen_server

<- Stdlib Reference | Language Guide | Detailed reference

OTP-style server behaviour built on std.actor.

(import std.actor.gen_server)
SymbolDescription
(gen-server-start callbacks init-arg opts)Start one server process and return its pid.
(gen-server-start-link callbacks init-arg opts)Start one server process and link it to the caller.
(gen-server-call server request timeout-ms)Send one synchronous request; return reply value or #f on timeout/server-down.
(gen-server-cast server message)Send one asynchronous message; returns 'ok or #f.
(gen-server-stop server reason timeout-ms)Stop one server with reason; waits for stop acknowledgement.

Callback contract and message protocol:

;; callbacks alist keys:
'init
'handle-call
'handle-cast
'handle-info   ; optional
'terminate     ; optional

'(gen-call ref from request)
'(gen-cast message)
'(gen-reply ref value)

Supported options:

See the runnable cookbook example: cookbook/concurrency/gen-server-counter.eta


Source: stdlib/std/actor/gen_server.eta