[plt-scheme] Proposal: Async FFI

From: Hans Oesterholt-Dijkema (hdnews at gawab.com)
Date: Sat Jul 7 19:34:36 EDT 2007

Dear All,

In my sqld-psql-c driver (see PLaneT) I've used an asynchronous mechanism
to call pqexec (a synchronous function call for PostgreSQL). I've done this
to enable scheme threads to run, while processing SQL queries.

I'd like to add such a mechanism to the FFI. Maybe through PLaneT, but
eventually I'd like this to be added to the FFI code. This will help greatly
for using certain libraries through the FFI, where functions can block for
a long time, e.g. DB2CLI, MySQL. But other C libraries, e.g. for image
processing can also be thought of.

My idea is to provide a set of basic C functions, like:

int f(int)
void f(int)
int f(string)

The C code for these functions can be generated. These functions do
the trick that can be reviewed in the sqld-psql-c PLaneT package, in
a generic way.

The FFI could be extended with get-ffi-obj/async. To provide calls
of these asynchronous functions. Of course this variant will have a
lot of restrictions, but this basic support would be quite good

What do you think of this idea?

Best regards,


Posted on the users mailing list.