Re: [racket] scheme_call_enable_break

2013-04-22 Thread Laurent
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). 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. For this last part

Re: [racket] scheme_call_enable_break

2013-04-22 Thread Diogo F. S. Ramos
Laurent writes: > (sync/timeout 0 (scheme_fd_to_semaphore s MZFD_CREATE_READ #t)) > > Unfortunately this does not work :) > It always returns #f. I'm not familiar with `sync/timeout' or `scheme_fd_to_semaphore', but from `sync/timeout's documentation: "A zero value for timeout is equivalent t

Re: [racket] scheme_call_enable_break

2013-04-22 Thread Laurent
Thanks for you answer Diogo, it actually made me think that I could use `sync/timeout' instead of trying to poll directly: (sync/timeout 0 (scheme_fd_to_semaphore s MZFD_CREATE_READ #t)) Unfortunately this does not work :) It always returns #f. I tried with MZFD_CHECK_READ instead, but got a segfa

Re: [racket] scheme_call_enable_break

2013-04-21 Thread Diogo F. S. Ramos
Laurent writes: > In particular, I'd like to use it with shawnpresser's unix domain socket > package [2] and its `accept' function, but I'm not sure how to make one work > with the other. Writing more about how to deal with the unix domain socket blocking, this is how I do it: I make an input

Re: [racket] scheme_call_enable_break

2013-04-21 Thread Laurent
It works, thank you very much! (I guess the first two `lambda's should be removed, since parameterize-break takes bodys and not exprs). Now I just need to figure out how to do the double check, and I'm done. On Sun, Apr 21, 2013 at 7:23 PM, Matthew Flatt wrote: > At Sun, 21 Apr 2013 11:05:01 -

Re: [racket] scheme_call_enable_break

2013-04-21 Thread Matthew Flatt
At Sun, 21 Apr 2013 11:05:01 -0600, Matthew Flatt wrote: > (define MZFD_CHECK_READ 3) Use (define MZFD_CREATE_READ 1) instead of MZFD_CHECK_READ. An advantage of writing documentation is that it reminds me how the function works. Racket Users list: http://lists.racke

Re: [racket] scheme_call_enable_break

2013-04-21 Thread Matthew Flatt
At Sun, 21 Apr 2013 18:30:44 +0200, Laurent wrote: > Is it possible to use scheme_call_enable_break [1] with a non-primitive > Racket procedure? No. That C function is merely (define (call/enable-break f) (parameterize-break #t (f))) but in a more convenient form to call from C. More genera

[racket] scheme_call_enable_break

2013-04-21 Thread Laurent
Is it possible to use scheme_call_enable_break [1] with a non-primitive Racket procedure? In particular, I'd like to use it with shawnpresser's unix domain socket package [2] and its `accept' function, but I'm not sure how to make one work with the other. I cannot really use the example of tcp-co