[squeak-dev] Re: [Pharo-project] Example of non-concurrent code :)
Igor Stasenko
siguctua at gmail.com
Sat Oct 16 05:36:44 UTC 2010
On 16 October 2010 08:14, John M McIntosh
<johnmci at smalltalkconsulting.com> wrote:
> Igor, take a look back in the messages from January 25th 2010
> Re: [Pharo-project] new mac menu code
> There may be something related there?
>
>
No, its not related, because i'm not running it on Mac.
It is the bug in my own FIFOQueue implementation, which triggered the
bugs all over the places where following assumed:
queue isEmpty ifFalse: [
self assert: queue nextOrNil notNil.
]
or
queue peek ifNotNil: [
self assert: queue nextOrNil notNil.
]
neither #peek not #isEmpty does not guarantees that at next send , a
queue will contain any items.
Its actually completely pointless to do such checks.
One should use #next , for blocking version , which blocks the caller
if there's no items in queue,
or use nextOrNil, for quick non-blocking attempt to fetch item from queue.
--
Best regards,
Igor Stasenko AKA sig.
More information about the Squeak-dev
mailing list
|