[plt-scheme] Proposal: Async FFI

From: Hans Oesterholt-Dijkema (hdnews at gawab.com)
Date: Sun Jul 8 09:23:56 EDT 2007

> and with `ffi-call/async':
>
>   (define cfun* (ffi-call/async some-fun-pointer (list _int _bool) _int))
>   (cfun (lambda (r) (printf "cfun returned ~s\n" r))
>         15 #f)
>
> But there is one major problem with all this...  MzScheme assumes that
> all calls to C are atomic, so it will be easy to make things break in
> unexpected ways.  (The simplest would be to have the asynchroneous
> call use a Scheme callback.)
>   
I see. It would become possible to do more than one call to C 
simultaniously,
from different scheme threads that is, because the call to the C 
function should block
anyhow.
> (This is on top of the usual problems like making whatever code yo
> write work on everything, including Windows, Solaris, OSX, *BSD, etc.)
>
>   
As mzscheme already uses OS threads in some way, I wouldn't expect a lot 
of problems
there...



Posted on the users mailing list.