[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] Timeouts for BlockClosures
From: |
Paolo Bonzini |
Subject: |
Re: [Help-smalltalk] Timeouts for BlockClosures |
Date: |
Thu, 21 Apr 2011 12:35:02 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9 |
On 04/21/2011 10:41 AM, Holger Hans Peter Freyther wrote:
> On 04/21/2011 07:52 AM, Paolo Bonzini wrote:
>
>> but you're walking on thin ice here. Every time you have a timeout,
>> you should assume that the data structures are in an inconsistent
>> state (just like when you #terminate a Process). I suggest making
>> your sockets unbuffered if it's not too much overhead.
>
> Right. It is not Erlang after all and we have side-effects. I am not sure on
> the semantics of the following. My work around would be something like
>
> [
> socket waitUntilItCanRead
> ] timeout...
>
> but I am not sure if canRead and such will behave better.
Yes, #ensureReadable will behave better. It does not have side effects:
self isOpen ifFalse: [^self].
self
fileOp: 14
with: 0
with: Semaphore new
ifFail: [[File checkError: self soError] ensure: [^self close]].
self
fileOp: 13
with: 0
ifFail: [[File checkError: self soError] ensure: [self close]]
Of course it may be that you don't have 3 bytes available when
#ensureReadable returns...
Paolo
- Re: [Help-smalltalk] Timeouts for BlockClosures, (continued)
- Re: [Help-smalltalk] Timeouts for BlockClosures, Paolo Bonzini, 2011/04/06
- Re: [Help-smalltalk] Timeouts for BlockClosures, Holger Hans Peter Freyther, 2011/04/06
- Re: [Help-smalltalk] Timeouts for BlockClosures, Paolo Bonzini, 2011/04/06
- Re: [Help-smalltalk] Timeouts for BlockClosures, Holger Hans Peter Freyther, 2011/04/06
- Re: [Help-smalltalk] Timeouts for BlockClosures, Paolo Bonzini, 2011/04/06
- Re: [Help-smalltalk] Timeouts for BlockClosures, Holger Hans Peter Freyther, 2011/04/11
- Re: [Help-smalltalk] Timeouts for BlockClosures, Paolo Bonzini, 2011/04/12
- Re: [Help-smalltalk] Timeouts for BlockClosures, Holger Hans Peter Freyther, 2011/04/20
- Re: [Help-smalltalk] Timeouts for BlockClosures, Paolo Bonzini, 2011/04/21
- Re: [Help-smalltalk] Timeouts for BlockClosures, Holger Hans Peter Freyther, 2011/04/21
- Re: [Help-smalltalk] Timeouts for BlockClosures,
Paolo Bonzini <=