From: kjana@...4lab.to (YANAGAWA Kazuhisa) Date: 2002-05-28T20:48:04+09:00 Subject: Re: SizedQueue.new(0) In message <20020527151351.GA1677@cs.auc.dk> larsch@cs.auc.dk writes: > Clearly, SizedQueue does not currently provide what I am looking for: A worker > thread multiplexer which blocks pushers unless there is a popper ready to take > the element immediatly. Sure. Since Queue and SizedQueue are a synchronized queue, they are expected to do queuing. > class EmptyQueue > def initialize > @waiting = Queue.new > @que = Queue.new > end > def push(obj) > @waiting.pop > @que.push obj > end > def pop > @waiting.push true > @que.shift > end > end > > Not particularly nice or efficent, but it works :) Probably this EmptyQueue should be named RendezvousBuffer or such because it doesn't queuing any more. -- kjana@dm4lab.to May 28, 2002 So many men, so many minds.