Subject: Re: Unification
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 25 Jun 2001 03:33:03 GMT
Newsgroups: comp.lang.lisp
Message-ID: <9h6bdf$j64ol$1@fido.engr.sgi.com>
David Thornley <thornley@visi.com> wrote:
+---------------
| Rob Warnock <rpw3@rigden.engr.sgi.com> wrote:
| >It's not that simple, since you almost certainly want (for example)
| >the "select()" system call to properly interact with any threading
| >that's built into your CL, and *that's* not likely to be a "small
| >matter of FFI".
|
| Is it any simpler with C?  That's the point I'm addressing.
| I don't see that CL has any disadvantage relative to C in
| APIs that can't be corrected by a bit of fiddling with FFI.
+---------------

The point was that the *system* (Common Lisp, Scheme, Python, whatever)
probably already has some internally-defined way of handling the
interactions between threads and I/O so as to make thread-local
blocking I/O actually be *non*-blocking in the application as a
whole. The question is whether those facilities have been exposed
to the FFI facility in such a way that you the user can write FFI-based
extensions that "play nice" with those internally-defined non-blocking
I/O facilities. (Without having to go digging around in the source code
of the Lisp system... which you might very well not have available!)

+---------------
| How is this done in C?  It's got to be a problem no matter which
| language you're working in.
+---------------

It's not so much a language issue per se, as an application system
issue.  For example, if you're trying to write an X Windows application
that also does socket reads/write to some other server (say, a database)
and you don't want mouse events to be locked out while you're waiting
for a remote server response, you're going to have to "play nice" with
the X event loop. [Now fortunately, the Xt Intrisics provide this nice
little "XtAddInput(unix_fd, reason, function, data)" that you can use.]

But you get the idea. In any Lisp system you want to be able to add
FFI-based I/O stuff to, you're going to need to find out the equivalent
of "XtAddInput()" for that system's thread/non-blocking-I/O management,
and use that in your FFI code.


-Rob

-----
Rob Warnock, 31-2-510		<rpw3@sgi.com>
SGI Network Engineering		<http://reality.sgi.com/rpw3/> [until 8/15]
1600 Amphitheatre Pkwy.		Phone: 650-933-1673
Mountain View, CA  94043	PP-ASEL-IA

[Note: aaanalyst@sgi.com and zedwatch@sgi.com aren't for humans ]