[gambit-list] res_query in the FFI

Christian christian at pflanze.mine.nu
Fri Oct 13 12:59:57 EDT 2006


At 12:39 Uhr -0400 13.10.2006, Lang Martin wrote:
>Well, Bernsteins library has an asychronous mode -- his preferred way
>of dealing w/ threads.

Ah, I didn't know that. This makes things appear in a different 
light; the question will now be how to get notified when the result 
is ready, and make the scheme thread continue timely (probably 
requires hooking the library into the Gambit event loop (someone has 
made available a patch for this already on this list), and somehow 
into the Gambit scheduler to make it instant). The easiest solution 
may be polling with an exponentially increasing sleep interval, that 
way it's still scalable in the number of threads, but the answer will 
be delayed a little bit. (I need to take a look at djbdns.)

>  > >Should I create a port? If so, can someone point me to a bit of the
>>  >source code that'll get me started with that?
>>
>>  ("No". But you may need ports to communicate readyness (and the
>>  address of some struct) to another pthread when implementing
>>  concurrency with pthreads.)
>
>seems to be a good interface if I go for the DJB async query.

I'm not sure that helps you anything; pipes are nice if you're 
waiting for another process or pthread (which really runs 
concurrently) to reply. But with an async query you'll have to "run 
the other end yourself", so there's no point using a pipe.

>Can
>someone point me to the contruction of a port?

cj-posix has it (or look at the discussion from July 29 till Aug 2). 
Maybe I should do a new release.

>Thanks very much, that was a thoughtful response.

You're welcome

Christian.



More information about the Gambit-list mailing list