help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Timeouts for SharedQueue and Semaphore


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Timeouts for SharedQueue and Semaphore
Date: Wed, 10 Nov 2010 16:12:46 +0100

On Wed, Nov 10, 2010 at 14:47, Holger Hans Peter Freyther
<address@hidden> wrote:
> On 11/10/2010 10:54 AM, Paolo Bonzini wrote:
>> On 11/10/2010 10:49 AM, Holger Hans Peter Freyther wrote:
>>> thanks, I will need to read it a couple of more times until I figure out 
>>> what
>>> I need to do.:)
>>
>> Nothing? :)
>
> What about the VM change for a cleanup? That is just to wait for multiple
> things to happen?

That would be quite huge.  Everything else is already pushed.

>>    (Delay forSeconds: 1) timedWaitOn: sema
>>
>> will wait on a semaphore for 1 second, and return true if the timeout
>> occurred, false if the semaphore was grabbed.
>
>    nextTimed: timeout [
>        "Wait for an object up to timeout seconds"
>        <category: 'accessing'>
>        | delay expired result |
>
>        delay := Delay forSeconds: timeout.
>        expired := delay timedWaitOn: valueReady.
>
>        expired ifTrue: [
>            "Raise some kind of exception"
>        ]
>
>        queueSem critical: [result := queue removeFirst].
>        ^result
>    ]
>
>
> so something like the above for SharedQueue would be acceptable upstream?

Sure.  Just make sure that: 1) the exception is not resumable; 2) if
there's anything like that in Squeak, it's compatible.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]