[#927] UnboundMethod#to_proc — Dave Thomas <dave@...>
I'm wondering what I can do with a Proc generated by
17 messages
2003/04/06
[#929] Re: UnboundMethod#to_proc
— "Chris Pine" <nemo@...>
2003/04/06
----- Original Message -----
[#934] Re: UnboundMethod#to_proc
— Mathieu Bouchard <matju@...>
2003/04/06
[#940] Re: UnboundMethod#to_proc
— chr_news@...
2003/04/07
>
[#941] Re: UnboundMethod#to_proc
— Dave Thomas <dave@...>
2003/04/07
>> If they have diverging interfaces such that the contracts conflict
[#936] docs on implementation of ruby and/or ruby-gc ? — Ruben Vandeginste <Ruben.Vandeginste@...>
4 messages
2003/04/07
[#964] Range in logical context — Dave Thomas <dave@...>
If I run
7 messages
2003/04/16
[#965] Re: Range in logical context
— Mauricio Fern疣dez <batsman.geo@...>
2003/04/16
On Thu, Apr 17, 2003 at 06:10:40AM +0900, Dave Thomas wrote:
[#973] problem with rb_rescue2() ? — Mathieu Bouchard <matju@...>
5 messages
2003/04/19
Creating thread safe classes for Ruby
From:
Konstantin Knizhnik <knizhnik@...>
Date:
2003-04-08 17:31:02 UTC
List:
ruby-core #951
Hello,
I want make my class correctly executed in multithreaded environment.
That is why I am using mutex class to synchronize access to the
object:
require "thread"
class Foo
def initialize()
@mutex = Mutex.new
end
def someCriticalMethod()
@mutex.synchronize {
... do something
}
end
end
But if I then invoke this method outside any thread I will get the
following error:
C:/ruby-180/lib/ruby/1.8/thread.rb:94:in `stop': stopping only thread (ThreadError)
note: use sleep to stop forever
from C:/ruby-180/lib/ruby/1.8/thread.rb:94:in `lock'
from C:/ruby-180/lib/ruby/1.8/thread.rb:127:in `synchronize'
...
Is there some correct way in Ruby to write thread safe code which will
be also executed outside thread context?
--
Best regards,
Konstantin mailto:knizhnik@garret.ru