[gambit-list] Is long poll for activity on external file descriptors without Gambit reading data currently doable, and if so, how?

Christian Jaeger christian at pflanze.mine.nu
Tue Sep 2 20:04:16 EDT 2008


Christian Jaeger wrote:
> Mikael More wrote:
>   
>> Hi!
>>
>> Is there any way to make Gambit's scheduler trig an event when there is
>> activity on external file descriptors, for instance as provided by
>> curl_multi_fdset ( http://curl.haxx.se/libcurl/c/curl_multi_fdset.html ) of
>> libCurl multi ( http://curl.haxx.se/libcurl/c/libcurl-multi.html )?
>>
>> The question was raised in 2004 (
>> https://webmail.iro.umontreal.ca/pipermail/gambit-list/2004-November/000023.html),
>> at that time without answer.
>>
>> What is the current answer to this question, is there any elegant way to
>> have Gambit monitor a set of external file descriptors, and trig an event
>> handler on event?
>>   
>>     
>
> I guess it was just missing setting the fd to nonblocking? See 
> |fd->port| and |fd-nonblock-set!| in 
> http://scheme.mine.nu/gambit/scratch/cj-posix/2006-12-06/cj-posix.scm
>   

Wait, I think I get what you want: you want to block your Gambit thread 
just as in a read or write operation but not actually carry out any read 
or write, correct? Just kind of peek-char that doesn't read into a 
buffer etc.; or basically, you want that this blocks until there is data 
to be read or there is the possibility to write data (pardon my shell 
syntax):

({read,write}-subu8vector (u8vector) 0 0 port)

That's a question for Marc I guess.

Christian.



More information about the Gambit-list mailing list