[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] Trouble with sockets
From: |
Mike Anderson |
Subject: |
Re: [Help-smalltalk] Trouble with sockets |
Date: |
Sat, 27 Jan 2007 20:28:44 +0000 |
User-agent: |
Thunderbird 1.5.0.8 (X11/20061025) |
Paolo Bonzini wrote:
> Mike Anderson wrote:
>> Here is a test script which exhibits something of the problems I'm
>> having, which I'm now thinking are because I'm opening a pipe during the
>> HTTP request, and the interaction between pipe and socket is unhealthy.
>
> Just to be sure, what version are you testing with? The infinite poll
> loop might have been fixed in smalltalk--stable--2.3--patch-11.
Right, with 2.3--patch-13 this is much better.
Something that has been troubling me is why, in the strace, does it show
both processes polling? One process is the main process; the second is
the popen:, but AFAICT, that process should live only from the fork on
line 1148 of sysdep.c to the _exit on line 1154. How does it get into
the poll loop?
Anyway, the behaviour is not quite perfect; since the pipe never returns
true to #atEnd, the default implementation of #do: ends with EndOfStream
being thrown.
I presume that there is some way to detect the atEnd condition in the C
code, or at least flag it when the pipe is closed. I'm feeling a bit
dense, so I can't work it out. If you have to attempt a read and fail,
then the semantics of working with pipes are different from working with
other streams - you have to do this:
FileDescriptor >> #do: aBlock
[ [aBlock value: self next ]
repeat ]
on: EndOfStream do: [ :ex | "This is expected - ignore." ].
Mike