Fastthread- released

== NOW

A new version of fastthread, the library providing better
implementations of the classes in thread.rb, has been released.

Please note that fastthread is only for Ruby 1.8, not JRuby or any other
Ruby implementation (most of them don’t need it anyway!).

== WHY

The existing implementation of Mutex, Queue, etc. in thread.rb is slow.

fastthread’s is faster (and bypasses the memory leak in Ruby 1.8’s
Array#shift to boot).

This particular release fixes two issues in previous fastthread

  1. rb_bug()s due to stale wait queue entries

  2. an uninitialized variable warning on load

== HOW

To use fastthread, just require it in addition to ‘thread’. The API is
identical to the existing classes, so you shouldn’t need to rewrite any
code (so long as you’ve been respecting the public interface of those

I’d recommend rescuing LoadError, to make it optional. (Remember, not
all Ruby implementations need it!)


Files are available from Rubyforge:


My hope is that fastthread won’t be needed for much longer – its code
has been merged into ruby_1_8 as a build option (in which case, simply
requiring ‘thread’ will get you the same stuff!), but there’s not been a
fastthread-enabled release yet.

As for alternate Ruby implementations, JRuby already has its own
implementation of the thread.rb primitives which uses native Java
monitors, and I think we can expect other Ruby implementations to follow
its lead.

But, until we get a new fastthread-ized 1.8 release, fastthread is still
here for you.