From: Kent Dahl Date: 2002-07-23T19:26:10+09:00 Subject: Re: class variables not thread-safe? Tom Sawyer wrote: > i'm guessing my API's > not thread-safe, but i'm not sure what factors make something > thread-safe or not really. does my use of class variables do that? Access to mutator methods (methods that change state) on a object from several threads of execution will make your code non-thread-safe. Class variables tend to be available to all instances of the class, and if you then have instances of the class in various threads, you are very likely to run into threading issues. You'll probably need to guard the access to the class variables. Take a look at the Mutex class. The PickAxe chapter should tell you most of what you need to know. ( http://www.rubycentral.com/book/tut_threads.html ) -- (\[ Kent Dahl ]/)_ _~_ __[ http://www.stud.ntnu.no/~kentda/ ]___/~ ))\_student_/(( \__d L b__/ NTNU - graduate engineering - 4. year ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)