<div dir="ltr"><div><div><div>Yes, but given Matthew's code, it first waits (i.e., blocks) with `sync' until a client tries to connect (but does not `accept' it yet).<br></div>Then it goes to atomic (i.e., somewhat non-interruptible) mode and before accepting the client, it checks again that the client is still there.<br>
</div>For this last part, I was trying to use sync/timeout; A zero value for the timer thus returns #f only if no event could sync, i.e. (I thought) if no client is waiting.<br></div>(From the docs: "If <span class="">timeout</span> is a procedure, then
it is called in tail position if polling the <span class="">evt</span>s discovers
no ready events.")<div><div><br></div><div>But it seems that the event has already been processed and is not available anymore or something.<br><br>Laurent<br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Apr 22, 2013 at 12:21 PM, Diogo F. S. Ramos <span dir="ltr"><<a href="mailto:diogofsr@gmail.com" target="_blank">diogofsr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Laurent <<a href="mailto:laurent.orseau@gmail.com">laurent.orseau@gmail.com</a>> writes:<br>
<br>
> (sync/timeout 0 (scheme_fd_to_semaphore s MZFD_CREATE_READ #t))<br>
><br>
> Unfortunately this does not work :)<br>
> It always returns #f.<br>
<br>
</div>I'm not familiar with `sync/timeout' or `scheme_fd_to_semaphore', but<br>
from `sync/timeout's documentation:<br>
<br>
"A zero value for timeout is equivalent to (lambda () #f). In either<br>
case, each evt is checked at least once before returning #f or calling<br>
timeout."<br>
<br>
So, I guess it's not a surprise that your call always returns `#f'. It's<br>
not blocking/waiting, how one would want in this situation.<br>
</blockquote></div><br></div>