[cl-muproc-devel] [PATCH] Adding Erlang-style timeout to MUMSG-RECEIVE
Vladimir Sekissov
svg at surnet.ru
Tue Jul 11 17:23:10 UTC 2006
Good day,
The patch in the attachment is adding Erlang-style timeout clause to
MUMSG-RECEIVE. TIMEOUT is active only on packet-matching phase
opposite to WITH-TIMEOUT which can break in the middle of message
processing clause body.
Semantic is the same as of TIMEOUT in Erlang RECEIVE statement.
Syntax:
(TIMEOUT TIMEOUT-VALUE &body TIMEOUT-BODY)
When TIMEOUT-VALUE is evaluated to:
NIL or 0 -- non-blocking receiving. TIMEOUT-BODY is evaluated
immediately if there is no pending input or all packet-matcing clauses
are failed;
NUMBER -- wait NUMBER seconds in packet-matching phase;
T (generic boolean) -- the same as Erlang INFINITY, wait before
matching input.
Example:
(mumsg-receive (from)
((request) t
(push request acc))
....
(timeout 0
(push :receiver-timed-out acc)
(%enqueue% mbox (nreverse acc))))
Tested with SBCL/CMUCL.
For CMUCL you need bug-fixed TIMER package and bug-fixing patch for
BORDEAUX-THREADS.
Both are in the attachments.
There is possible conflict in simultaneous use of TIMEOUT in RECEIVE
and WITH-TIMEOUT if implementation-dependent timers don't care about
recursion (one timer can catch a signal from another).
I fixed this for SBCL/CMUCL but haven't access to LispWorks and OpenMCL.
Best Regards,
Vladimir Sekissov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CHANGESET.gz
Type: application/octet-stream
Size: 3520 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cl-muproc-devel/attachments/20060711/1d4ea7f3/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BORDEAUX-CHANGESET.gz
Type: application/octet-stream
Size: 1048 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cl-muproc-devel/attachments/20060711/1d4ea7f3/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: timer.tar.gz
Type: application/octet-stream
Size: 7293 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cl-muproc-devel/attachments/20060711/1d4ea7f3/attachment-0002.obj>
More information about the cl-muproc-devel
mailing list