Article View: comp.sys.next.programmer
Article #576Re: Pipes, Child Processes and Other Uglies
From: Christopher M Songer
Date: Wed, 08 Apr 1992 14:39
Date: Wed, 08 Apr 1992 14:39
37 lines
1969 bytes
1969 bytes
I write:
> It's possible this belongs on one of the UNIX groups, but it
>touches on some NeXT stuff so I thought I'd try here first. I'm in
>the midst of doing an App that uses Allegro for some NLP stuff. I'm
>spawning a cl process and making its stdin one end of a pipe, and its
>stdout another end of a pipe like this:
>
>if((pid = fork()) == 0) {
> fclose(stdin);
> dup(cl_stdin);
> fclose(stdout);
> dup(cl_stdout);
> execl(...);
> }
>
> Here's my problem. Common Lisp can respond to commands in its
>own sweet time. I don't want to sit around polling on the file
>descriptor all the time. This would hose the user interface. What
>I want to happen is this:
>
> When the OS detects something to be read on the descriptor it
>wakes up a thread (or whatever) and the thread takes care of all my I/O.
>I think maybe the SIGIO signal sort of does this -- but it seems awefully
>crufty to me. (Not thread based at all, and who wants to poll ALL the
>possible descriptors.)
>
I got loads of great responses for this. Thanks! Just to save time and
bandwidth I figured I'd summarize.
Basically there are two facilities for doing this. The first is a vanilla
BSD routine called select(2). The second is a NeXTstep specific called
DPScallFD(). Alternatively there is a NeXTstep example called Subprocess
which does all this for you. Guess which I'll use :)
-Chris
Technical Details
Message-ID:
<1992Apr8.143943.29156@noose.ecn.purdue.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!news.cs.indiana.edu!noose.ecn.purdue.edu!ei.ecn.purdue.edu!songerReferences:
<1992Apr7.170318.19742@noose.ecn.purdue.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!news.cs.indiana.edu!noose.ecn.purdue.edu!ei.ecn.purdue.edu!songer From: songer@ei.ecn.purdue.edu (Christopher M Songer) Newsgroups: comp.sys.next.programmer Subject: Re: Pipes, Child Processes and Other Uglies Message-ID: <1992Apr8.143943.29156@noose.ecn.purdue.edu> Date: 8 Apr 92 14:39:43 GMT Article-I.D.: noose.1992Apr8.143943.29156 References: <1992Apr7.170318.19742@noose.ecn.purdue.edu> Sender: news@noose.ecn.purdue.edu (USENET news) Organization: Purdue University Engineering Computer Network Lines: 37