From: Robert Klemme Date: 2010-02-15T23:31:42+09:00 Subject: Re: Mutex 2010/2/15 Mido Peace : > Hi, > I have a trouble using the ConditionVariable and Mutex Class , > Actualy , I'm tryin' to make a Semaphore to manage Threads > a simple semaphore with its 2 famous methods looks like : > > def acquire() > >    raise "Interrupted Thread " if (!Thread.current.alive?) >    @mutex.synchronize { >     while @permits < 1 >       @cv.wait(@mutex) >     end >    @permits = @permits - 1 >    } > end > > > def release() >    @mutex.synchronize{ > >      @permits += 1 >      @cv.signal > >      } > > end > > > But When I call The acquire Method later > > I get : `wait': stopping only thread (ThreadError) > > SomeOne has an idea ?? Not without the full code. What you showed looks OK. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/