From: Michal Rokos Date: 2002-08-22T19:06:15+09:00 Subject: Re: [Cleanup?] Int vs Long Hi, On Wed, Aug 21, 2002 at 02:00:17PM -0400, James F. Hranicky wrote: > > How's ThreadSafeRuby coming along? > My idea was to bring real threads to Ruby (POSIX, Windows, or SW emul (as it is now)). For native threads, you definitely need some locking. The problem is what to lock. ==================================== My idea was to add RW-Lock into every ruby object (to RBasic struct). So: Every binding method should call rb_lock_wr, or rb_lock_rd. I think that we cannot use POSIX rwlock, because we need reentrant write lock for the same thread (or rewrite methods not to call each other that could be definitely a big pain) - so we have to write our own RWlock) As I calculated the space needed for this new lock, it could add about 5 pointers size to every Ruby object, that means: doubles memory needs! (Current std. Ruby object is about 5 pointers as well) I'm not sure wether it is acceptable. Also this could bring a lot of deadlocks and I'm not sure if it is suitable for eval and parsing part. ==================================== If you will have just 1 global lock, I don't see any benefit of bringing native threads in. So the project has stopped because of lack of discussion. Michal -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Michal Rokos Czech Technical University, Prague E-mail:m.rokos@sh.cvut.cz ICQ:36118339 Jabber:majkl@jabber.cz -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-