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: Holger Hans Peter Freyther
Subject: Re: [Help-smalltalk] Timeouts for SharedQueue and Semaphore
Date: Wed, 10 Nov 2010 14:47:29 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b2 Thunderbird/3.1.6

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?


> 
>    (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? Or
should I keep it as an extension?



reply via email to

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