From: "S.Z." Date: 2005-10-13T21:06:56+09:00 Subject: Re: How to overload Object's methods automagicaly? Robert Klemme wrote: > from what I understand from your postings your aim is to > make each method synchronized automatically. Or are you saying that you > want to use a delegate pattern where method_missing is used to call the > original instance's method synchronized? I want to use method_missing() to call the original methods synchronized. > I did already. Every scenario where at least two method calls on the same > or multiple objects have to be atomic with regard to other threads' > activities. Below you have mentioned Monitor#synchronized(), that is just a contradiction. > You have that feature already with Mutex#synchronized and > Monitor#synchronized. There's also a variant as mixin (see doc ref > below). Yes I have. But I dislike both. I know a better solution only for scenarios where my Sync class can be applied. But I am looking for the others... > So you're using Java's delegation approach Yes, I do the same with Ruby. > You don't need to create that on your own. It's already there Look at MonitorMixin example: http://www.ruby-doc.org/stdlib/libdoc/monitor/rdoc/classes/MonitorMixin.html Is not this an errorprone code? I need a better sync mechanism that defines "producer" and "consumer" and has the correct zyncronization built in. -- Best regards, S.Z.