From: "Hal E. Fulton" Date: 2003-03-12T03:10:09+09:00 Subject: Re: Threads and DRb ----- Original Message ----- From: "Robert Klemme" Newsgroups: comp.lang.ruby To: "ruby-talk ML" Sent: Tuesday, March 11, 2003 3:50 AM Subject: Re: Threads and DRb > > "Kent Dahl" schrieb im Newsbeitrag > news:3E6D8640.68BEFA28@stud.ntnu.no... > > "Hal E. Fulton" wrote: > > > > a.extend ThreadSafe > > > > If it is always done like above, couldn't you do the > > > > > if not @__tsmutex then @__tsmutex = Mutex.new end > > > > In a system hook once per server object? > > > > http://www.rubycentral.com/book/ref_c_module.html#Module.extend_object > > Can't one just alias initialze and rededine it? > > module ThreadSafe > alias __tsinit initialize > > def initialize(*args) > @__tsmutex = Mutex.new > __tsinit(*args) > end > def __send__(*args) > @__tsmutex.synchronize { super(*args) } > end > end Good ideas, Kent and Robert. I think I like this one best so far. I'm still curious to know the potential dangers of redefining __send__, if anyone can elaborate. Hal