David Bakhash <cadet@alum.mit.edu> wrote:
+---------------
| There are non-forking servers, but they're complicated as hell.
| If they're non-forking, then they use select() and special non-blocking
| directives, and as far as I know, no Lisp-based socket system lets
| you go there.
+---------------
Actually, MzScheme (the engine underneath DrScheme) provides select()-based
scheduling in its thread system. You write code within a Scheme thread
that *looks* likes it's blocking, but instead of blocking in the socket
I/O, the internal scheduler adds that fd to the FD_SET of the select()
call and runs some other thread.
Back on July 13th, Shriram Krishnamurthi <shriram@cs.rice.edu> posted
to comp.lang.scheme a tiny (couple of pages) web server written in
MzScheme that leaves the top-level listener running while servicing HTTP
requests -- useful for debugging. The server itself was single-threaded,
but moving the "thread" call until after the "tcp-accept" would make it
run a thread per request. See <URL:news:j7vya35jz47.fsf@sun.cs.rice.edu>
for the code.
[O.k., it's Scheme, not Lisp, but the point is that you *can* seamlessly
integrate a socket facility with Scheme threads, and probably with (some)
Lisps, too.]
-Rob
-----
Rob Warnock, 41L-955 rpw3@sgi.com
Network Engineering http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
1600 Amphitheatre Pkwy. PP-ASEL-IA
Mountain View, CA 94043