On Friday 21 April 2006 10:47 am, Kroeger, Simon (ext) wrote:
> Dear ruby-talk,
>
> is there a nice, concise way to lock each and
> every method against all other methods of an object?
>
> To elaborate: I want to make sure that only one method of
> a specific object (not class) can run at a each point in
> time regardless of how many threads are using this object.

> I would hope there is module i just have to include in
> my class definition.
>
> cheers and thanks
>
> Simon

It would be relatively easy to write a class that uses Monitor and delegates 
to specifc object.  Thus, much like Java's Collections.synchronizedFoo, you 
could have 

Synchronizer.new(foo) that would synchronize ANY object.

David