[Q] Has SharedQueue a very subtle bug?

Göran Hultgren goran.hultgren at bluefish.se
Mon Apr 29 19:10:24 UTC 2002


Hi Hans-Martin and all!

Quoting Hans-Martin Mosner <hmm at heeg.de>:
> goran.hultgren at bluefish.se wrote:
> 
> > PS. This thread talks about plenty of problems and solutions to the
> > SharedQueue class. Someone (perhaps me being a harvester) should sit
> > down and try to rewrite it so that it actually works. DS
> 
> The actual problem is only that the #next method signals an error when
> it
> finds that after waiting on readSynch, there is no element in the queue.
> This
> can easily be fixed by turning it into a loop which repeatedly waits on
> readSynch and tries to get an object out of the queue until it succeeds.

This is btw, quite exactly what we did in SharedBufferStream (posted a while ago).

> In
> addition, all other methods accessing contentsArray, readPosition and
> writePosition should use accessProtect to avoid race conditions.
> Attached find a change set implementing just these changes. To be a good

Ok, I will take a look at it now that I have all the issues "fresh" in my head.

> boy,
> I also updated the class comment and documented the instance variables.

Good! :-)

> Please check this implementation and see whether you find any
> weaknesses
> (apart from processes being brutally terminated in the middle of
> protected
> code...).

I will.

> Cheers,
> Hans-Martin

Cheers, Göran


Göran Hultgren, goran.hultgren at bluefish.se
GSM: +46 70 3933950, http://www.bluefish.se
\"Department of Redundancy department.\" -- ThinkGeek



More information about the Squeak-dev mailing list