Tudor Girba wrote:
>
> This sounds interesting. Would it be possible to get a code sample (in
> particular of the waitUntil: method)?
>
Sure. Here's the code we use in VW. I clearly didn't remember exactly
what we called it. :-)
We have a number of simpler methods that use this one, which is the most
general case. Once you account for GemStone and VW-specific stuff, I
imagine this approach should work in Pharo.
Regards,
-Martin
gbtPauseUntil: validateBlock evaluatesReturning: expectedResult
maxWaitSeconds: maxWaitSeconds
"Evaluate validateBlock until it returns expectedResult or
maxWaitSeconds have passed,
pausing between evaluations. Return the last result of validateBlock
value"
| startTime result |
startTime := Time secondClock.
[result := validateBlock value = expectedResult] whileFalse:
[Time secondClock - startTime > maxWaitSeconds ifTrue:
[^result].
(GbxDelay forMilliseconds: 50) wait].
^result
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project