Hi guys,

I'm having an issue with a multi-threaded system I'm developing.

Sorry if my question sounds too generic and unspecific but:
Are there any known pitfalls that one might come across when using
threads?

This is the code that runs the threads:
(I'm new to this so the code is borrowed from another post from this
list.)
---------
    def run_mods( page_data, structure )

        mod_queue = Queue.new

        @threads = ( 1..@opts[:threads] ).map {
            |i|
            Thread.new( mod_queue ) {
                |q|
                until( q == ( curr_mod = q.deq ) )

                    if( !run_module?( curr_mod , structure ) )
                        print_verbose( 'Skipping ' + curr_mod.to_s +
                            ', nothing to audit.' )
                        next
                    end

                    print_debug( )
                    print_debug( 'Thread-' + i.to_s + " " +
curr_mod.inspect )
                    print_debug( )

                    print_status( curr_mod.to_s )

                    mod_new = curr_mod.new( page_data, structure )

                    mod_new.prepare   if curr_mod.method_defined?(
'prepare' )
                    mod_new.run
                    mod_new.clean_up  if curr_mod.method_defined?(
'clean_up' )

                    while( handle_interrupt(  ) )
                    end

                end
            }
        }

        # enque the loaded mods
        for mod in ls_loaded_mods
            mod_queue.enq mod
        end

        @threads.size.times { mod_queue.enq mod_queue }
        @threads.each { |t| t.join }

    end
-----------------

The modules call their parent and the parent uses Net::HTTP.
Then they get the HTTP response via the parent and manipulate it in some
way.
My main problem is that from what I've gathered some HTTP calls fail
without an error.

Some modules just don't produce any results when the thread count is set
higher than 1.

I normally wouldn't bother you with something so broad but I've been
debugging this for 24 hours straight so I figured that someone else
might have run to a similar problem and save me 24 more hours of
debugging.

Has anyone else had a similar experience?
-- 
Posted via http://www.ruby-forum.com/.