Curiosity gets the better of me

David T. Lewis lewis at mail.msen.com
Tue Nov 1 00:32:36 UTC 2005


On Mon, Oct 31, 2005 at 01:22:49PM -0000, Bob.Cowdery at CGI-Europe.com wrote:
> David T. Lewis wrote:
> 
> > If you want a Squeak server to talk to your 'C process' through OS
> > pipes, you can do this with class PipeableOSProcess. You need to load
> > the packages OSProcess and CommandShell from SqueakMap (PipeableOSProcess
> > is in the CommandShell package). If your 'C process' interacts with
> > the world through stdin and stdout streams, this would be a reasonable
> > thing to do. This only works on Unix/Linux, but it would be fine for
> > your Linux server.
> 
> David. I'm not sure this does what I want. I think it only deals with
> unnamed OS pipes and not named pipes. However, I think I can treat names
> pipes just like they were files except I need to do an fcntl or equiv to
> ensure non-blocking reads. Have you, or anybody else done this before?

Yes, that's correct. If you prefer to use named pipes, you should be
able to treat them as regular files (no need for OSProcess or any other
add-on packages). I have not personally tried this, but I know of no
reason that it would not work.

Do be careful of blocking reads on pipes though. The Squeak VM runs
in a single OS process, and a blocking read will hang the entire
VM if you are not careful. Note that if this happens on Linux you
can always go to the /proc/<squeakprocess>/fd/* files and pump data
into the file descriptors to unconstipate the VM. Also, see the
#primSQFileSetNonBlocking: method in OSProcess for a way to
prevent blocking the VM. This should work with named pipes also.

Dave




More information about the Squeak-dev mailing list