[plt-scheme] Re: Using LibFFI along with threads

From: Noel Welsh (noelwelsh at gmail.com)
Date: Tue Jul 17 08:28:09 EDT 2007

This would be a useful addition.  I have some suggestions that may
improve your ideas:

 - It should be possible to specify an OS thread to use.  OS thread
creation is quite expensive on some systems.

 - The returned value should be a syncable value.  This is a simpler
programming model than the callback suggested in a previous thread.


On 7/17/07, Hans Oesterholt-Dijkema <hdnews at gawab.com> wrote:

> That's exactly what I want. PLT Scheme (DrScheme,MzScheme)
> doesn't do OS threads. In real life this means that a call to a
> native C function will block your entire scheme language
> including all "threads" in scheme.
> What I want is to do a "non blocking" call to a C function, by
> starting the C function in an OS thread and let the current scheme
> thread wait for the result, while allowing other scheme threads
> to run. I've done this trick already in the past, but without the
> FFI. However, it needs a littlebit of C code that must be compiled,
> and the goal of using the ffi is to allow for native C bindings
> without the need to compile glue code.

Posted on the users mailing list.