From: kjana@...4lab.to (YANAGAWA Kazuhisa) Date: 2002-05-27T23:03:54+09:00 Subject: Re: SizedQueue.new(0) In message <20020527124344.GG17772@cs.auc.dk> larsch@cs.auc.dk writes: > > > Is this a bug in Ruby or my brain? :-) > > > > > > $ sizedqueue.rb > > > quire 'thread.rb' > > > q = SizedQueue.new(0) > > > Thread.start { q.pop } > > > q.push 1 > > > > Maybe it has something to do that you define an empty queue? > > > > This works: > > > > q = SizedQuere.new(n) # n > 0 > > But I want an empty queue. I expected pushing the first element on a > queue with max 0 elements to block the thread, just as a pushing the > 5th element on a full queue with max 4 elements. Yes, so the main thread pushing 1 to the queue is blocked. The other thread popping from the empty queue is also blocked. So no threads are running and therefore ruby reports deadlock is occurred since blocking threads never become running. ....What is your problem? Your empty queue is empty and will never have an new element. That's your desire? -- kjana@dm4lab.to May 27, 2002 It is comparison that makes men happy or miserable.