From: kjana@... (YANAGAWA Kazuhisa) Date: 2000-10-05T23:06:08+09:00 Subject: [ruby-talk:5308] Re: Proper ConditionVariable usage? In message <877l7o375b.wl@studly.netlab.co.jp> shugo@ruby-lang.org writes: > > class YASizedQueue < YAQueue > (snip) > > def enq(obj) > > @mutex.synchronize do > > while @que.length >= @max > > @full_cond.wait(@mutex) > > end > > super(obj) > > end > > end > > Sorry, Mutex is not re-entrant. (So this program cause dead-lock.) > Please use Monitor instead of Mutex. NOTE: A problem above is a one of similar situations known as ``inheritance anomaly'' --- embedded synchronization codes prevent ``normal'' inheritance where one can use super class's code without knowledge of its implementation. Even merely adding constraints may need to reimplement other methods. -- kjana@os.xaxon.ne.jp October 5, 2000 Behind the clouds is the sun still shining.