Jan Vrany wrote:
Hi there,
I have encountered a situation where semaphore timeouts prematurely when run in "non-interactive" mode (eval cmdline handler).
Setup (script prepare.sh)
1) Fresh Pharo image (3.0 / 4.0, both exhibits the same behaviour) 2) Evaluate: == Smalltalk at: #WaitBlock put: [:sema :tout | (sema waitTimeoutSeconds: tout) ifTrue:[ Halt now ] ]. == 3. Save image
Run 1: 1) Run the image, open workspace 2) Evaluate: == | sema | sema := Semaphore new. [ 100 factorial. sema signal ] fork. (Smalltalk at: #WaitBlock) value: sema value: 60*60. 'OK' == Returns 'OK' as expected (100 factorial should not take more than hour :-)
Run 2 (script test.sh) 1) The same, but evaluate using command line handler: ./pharo Test.image eval "\ | sema |\ \ sema := Semaphore new.\ [ 100 factorial. sema signal ] fork.\ (Smalltalk at: #WaitBlock) value: sema value: 60*60.\ 'OK'\ " Halt triggers, which is what I would not expect.
Why is that? Bug? Or Am I missing something obvious?
Best, Jan
Is it like the thread on "Super fast delay" ? http://forum.world.st/Super-fast-delay-td4787257.html I have a fix for Pharo 4 ready to be reviewed... https://pharo.fogbugz.com/default.asp?14353 cheers -ben