From: kjana@...4lab.to (YANAGAWA Kazuhisa) Date: 2002-04-12T03:20:50+09:00 Subject: Re: Thread safety of Queue.push In message 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.