tags:

views:

82

answers:

2

Ruby 1.9 has threads, but they have lots of problems -- the biggest one is that they don't work the same cross platform (priority behaves differently, loop {} inside a thread will eat the whole process in Solaris, but not Linux nor green threads, etc.).

However, they made the new native threads class name the same as the old green class: Thread.

Is there a way to bypass this reliably? Or build ruby 1.9 without native threads?

I suppose I could drop the old green Thread class in, but I don't know if that will allow C extensions that aren't thread safe to work right.

Ciao!

A: 

AFAIK, the Thread class is written in C so you would have to recompile the Ruby version including the previous implementation. Indeed, there might be some incompatibilities.

I don't have many experience with Solaris and Threads. If you largely use Threads, one possible solution would be to use JRuby instead of the standard Ruby implementation. JRuby is based on the JVM and has native threads comparable with standard Java threads. I assume a Java-based environment would work as expected on Solaris.

Simone Carletti
A: 

This sounds like a bug. If you could report it at the Ruby issue tracker, that would be very nice. As for your question, I don't think you could very easily change how ruby handles threads, but take a look at the ./configure options (./configure --help) and see if there's something related there.

dvyjones
I have some bugs in: http://redmine.ruby-lang.org/issues/show/2359I guess I should file a "is this really what we want to do" bug...
The Doctor What
I just filed a generic bug. We'll see what happens. http://redmine.ruby-lang.org/issues/show/2505
The Doctor What