[gambit-list] How thread-mailbox-extract-without-rewind

Vok Vojwo ceving at gmail.com
Fri Oct 28 05:08:50 EDT 2011


2011/10/28 Adrien Piérard <pierarda at iro.umontreal.ca>:
>
> (let ((message (thread-receive)))
>  (if (need-to-unread? message)
>    (thread-send (current-thread) message))) ;; back in da game \o/
>

Doing that would break the message tupples.

Example inbox:

a1 a2 b1 c1 b2 a3 c2 b3 c3

1. take a1, a-slot is empty, next
2. take a2, a-slot is full, unread by sending to thread

After that the inbox contains:

b1 c1  b2 a3 c2 b3 c3 a2

Now a2 comes after a3 and the second message tuppel would be (b2, a3, c2).

The position in the inbox must be preserved. This is only possible by
a drop after peek or an unread at the original position.



More information about the Gambit-list mailing list