From: Ilan Berci Date: 2009-02-04T23:46:51+09:00 Subject: Re: Using a Class (not an instance) into threads I単aki Baz Castillo wrote: > > > So I wonder how could I use this class into a threaded program. AFAIK > a singleton class is the Class itself, so if a running thread modifies > some singleton attribute then all the other threads will see that > change (error!!!). > > Am I right? How could I achieve it? > This is not an example of a "singleton class". It is merely a class with static methods which means that you don't have to make an instance prior to using it. If the class that Ragel populated has no state (which I don't believe it does) then it can safely be used in a threaded context. If you need further examples, please check out all the class level methods in Math ================================================================= As for "singleton class", The class is not the object itself as you stated, but a class created solely for that instance. class Foo end f = Foo.new def f.poo 1 end f.class <== Foo f.poo <=== 1 Foo.new.poo <== undefined method! -- Posted via http://www.ruby-forum.com/.