From: Dave Thomas Date: 2001-05-19T18:27:13+09:00 Subject: [ruby-talk:15395] Re: PROPOSAL: Java-like method-based synchronization mechanism in Rub y Wyss Clemens writes: > class Module > def synchronized(*methods) > if methods.size() > 0 then > # we need a Mutex (-getter) > module_eval <<-EOS > def __mutex__() > if (@__mutex__.nil?()) then > @__mutex__ = Mutex.new() > end Is this thread safe, or could two different threads each generate their own mutex? > Note: �synchronized� is to be applied in the same manner as �attr_reader�, > �attr_writer�, etc. I wonder if it should be more like 'protected', 'private', and 'public'? That is, it can apply to a list of methods, or to all subsequent methods. Dave