[Mongrel] Rubygems and Fastthread problem

Ezra Zygmuntowicz ezmobius at gmail.com
Sat Dec 30 18:36:20 EST 2006

On Dec 30, 2006, at 12:36 PM, MenTaLguY wrote:

> On Wed, 2006-12-27 at 01:42 -0500, Wilson Bilkovich wrote:
>> I asked Eric Hodel about it, and he said it looked like the 'thread'
>> requirement in rubygems was added accidentally.  That was after  
>> only a
>> few moments of contemplation, so it may turn out differently in the
>> long run.
> Any updates on this since?
> -mental

Hey Mental-

	I have been talking with Eric Hodel about this and he had a  
suggestion. Maybe instead of requiring that fastthread be required  
before thread we should add the necessary Object.send :remove_const    
calls to remove Thread and Mutex and friends. would that work?

	I took the latest fastthread code and made these changes to the C  
code and recompiled. It seems to be working fine but I am not sure  
how to tell that fastthread is really loaded instead of thread. Here  
is what I did:

  # I removed this test:
   if (!RTEST(rb_require("thread"))) {
     rb_raise(rb_eRuntimeError, "fastthread must be required before  

# and added these statements.
   rb_mod_remove_const(rb_cObject, rb_str_new2("Mutex"));
   rb_mod_remove_const(rb_cObject, rb_str_new2("ConditionVariable"));
   rb_mod_remove_const(rb_cObject, rb_str_new2("Queue"));
   rb_mod_remove_const(rb_cObject, rb_str_new2("SizedQueue"));

	This seems to work fine but I am unsure. Mental what do you think  
about this? Now instead of requiring fastthread after thread, we  
require thread and then require fastthread. Or since rubygems is  
already gong to require thread this takes care of it.

	It does seem better to allow fastthread to come after thread like  
this. In your test cases I also added require 'thread; before the  
require 'fastthread' to make them work. How can we verify that this  
is a valid fix?


-- Ezra Zygmuntowicz 
-- Lead Rails Evangelist
-- ez at engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)

More information about the Mongrel-users mailing list