Simple lock up with delay + semaphore - not fixed with 0006576

Georg Köster georg.koester at gmail.com
Sat Jan 5 13:18:59 UTC 2008


Hey I prefer Tom's version! I shouldn't be racy if I read the resumeProcess
and resume code correctly. The resumeProcess message has no effect on
non-waiting processes!

>               | waitingProcess wakeupProcess |
>               waitingProcess _ Processor activeProcess.
>               wakeupProcess _
>                       [(Delay forMilliseconds: (anInteger max: 0)) wait.
>                       self resumeProcess: waitingProcess] fork.
>
>               self wait.
    "preempting here and getting the resumeProcess message sent would have
no effect - therefore no race!"
    "in comparison having a semaphore getting signaled here would cause an
excess signal on the sem: bad"
>               wakeupProcess terminate.

Cheers!
Georg

On Jan 5, 2008 9:43 AM, Andreas Raab <andreas.raab at gmx.de> wrote:

> Tom Phoenix wrote:
> > Is that the source in your image for that method? Here's what I have:
> >
> >       waitTimeoutMSecs: anInteger
> >               "Wait on this semaphore for up to the given number of
> milliseconds,
> > then timeout. It is up to the sender to determine the difference
> > between the expected event and a timeout."
> >
> >               | waitingProcess wakeupProcess |
> >               waitingProcess _ Processor activeProcess.
> >               wakeupProcess _
> >                       [(Delay forMilliseconds: (anInteger max: 0)) wait.
> >                       self resumeProcess: waitingProcess] fork.
> >
> >               self wait.
> >               wakeupProcess terminate.
>
> How odd. It seems that this version is only present in 3.9 - all other
> images have a variant of the (much simpler) code:
>
> waitTimeoutMSecs: anInteger
>     "Wait on this semaphore for up to the given number of milliseconds,
> then timeout. It is up to the sender to determine the difference between
> the expected event and a timeout."
>     | d |
>     d := Delay timeoutSemaphore: self afterMSecs: (anInteger max: 0).
>     [self wait] ensure:[d unschedule].
>
> The 3.9 version is tagged "jf 12/2/2003" but there is no indication what
> it is trying to address (if anything).
>
> Cheers,
>    - Andreas
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080105/3d5e2e21/attachment.htm


More information about the Squeak-dev mailing list