In message <Pine.LNX.4.40.0204110805340.32641-100000 / retch.ugcs.caltech.edu>
leon / ugcs.caltech.edu writes:

> > I'm using one mutex to sync pops (I only want one thread to get each
> > object) and one to sync pushes (do I really need one for pushes?)
> 
> Yes. The queue is a shared resource and should have the property of
> atomicity for any kind of transaction that alters it.

Do you mean what Queue?  On that in thread.rb, its methods are all
thread safe since it IS designed so.  If Queue#{push,pop} have race
condition problem, that is a bug to be fixed.

In implementation point of view, their atomicity is ensured by setting
Thread.critical true.  This technique is used in implementation of
Mutex.


-- 
kjana / dm4lab.to                                 April 12, 2002
Better late than never.