[Q] Has SharedQueue a very subtle bug?

Lex Spoon lex at cc.gatech.edu
Fri Apr 12 14:44:56 UTC 2002

goran.hultgren at bluefish.se wrote:

> > Why does #peek modify the SharedQueue state at all? It shouldn't be 
> > necessary. Just remove these assignments. 
> It's a "smart" performance thing. The idea is that if the queue is empty
> (readPos=writePos) then
> the queue can move the pointers down to the beginning of the
> contentsArray and thus avoid
> senseless growing. But you probably understood that of course. :-)

But is #peek the best place to do this?  #next and/or #nextPut: would
seem better.  Not all applications will even call #peek, but they will
all use #next and #nextPut:.

> I would guess though that there might be other methods in SharedQueue we
> would not want to
> "interrupt" with size/isEmpty.



More information about the Squeak-dev mailing list