From: Brad Tilley Date: 2006-11-08T04:54:33+09:00 Subject: Re: Inter-thread synchronization Quoting Caleb Clausen : > I'm actually of two minds about whether a future ruby that supports > native threads should still have green threads too using the existing > Thread/Mutex/Queue/etc. Usually when making the transition from one to > the other, you want to keep the old interface around for > compatibility. Green threads are generally cooperative... I thought this too. I've been using green threads in Ruby lately. They are not that bad. Certainly, they do some things well... especially smaller things. If it's not too difficult, having green threads available in YARV/Ruby 2.0 would be nice. Perhaps users could choose between using the new native threads or the old green threads. If this is too difficult, or not very feasible, that's OK. If I could only have one, I would choose native threads. > Finally, a fairly trivial item. It's somewhat confusing that you have > to require 'thread' and not 'mutex' to get the Mutex class, whereas > Thread is built-in and one doesn't need to require 'thread' to get it > at all (if you can manage without high-level synchronization). Isn't the same true about Queue? I found that confusing the first time I used threads... until I discovered that I had to require 'thread' first: irb(main):013:0> x = Queue.new NameError: uninitialized constant Queue from (irb):13 from :0 irb(main):014:0> require 'thread' => true irb(main):015:0> x = Queue.new => # irb(main):016:0> puts x.class Queue => nil irb(main):017:0>