On 04/06/2011 08:45 AM, Paolo Bonzini wrote:
> Almost there indeed, thanks for clarifying!
>
> First comment: please move the TimeoutNotification under the Kernel namespace.
>
>> +BlockClosure extend [
>> + timeout: seconds do: aBlock [
>
> So what do you think about passing a delay here? Or even making this method
> Delay>>#value:onTimeout:? Do you know what other Smalltalks do?
I am not sure. So far I have only seen individual timeouts for socket
operations. I am going to browse the Pharo code and see if there are some
constructs for timeout handling. I would like to be able to either pass a
Delay (for subseconds) or the seconds as Number. Maybe have two selectors and
make the one with a Number create the delay?
>
>> +<category: '*timeout-private'>
>> + "I will execute myself for up to seconds and if a timeout
>> + occurs I will invoke the aBlock. If the timeout occurs early
>> + not much of the block is executed yet. I also have some issues
>> + with Delays and not breaking these properly.
>
> Is the comment still accurate?
No, I will update it.
>> + ]
>> +]
>
>> + ] timeout: 1 do: [events add: 'timeout'].
>
> Larger timeout, please (1s for example).
The number is treated as a second already. The result will make sure that the
internal blocks has been executed, on a slow system the 1s might be too low.
will send an updated patch later today
holger
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk