def barrier(immediate=true, time_out=nil, &blk)
      if immediate && member_thread?
        return blk.call
      end
      
      q = ::Queue.new
      time_start = ::Time.now
      
      self.pass {
        begin
          q << blk.call
        rescue Exception => e
          q << e
        end
      }

      em_sig = nil
      if time_out
        em_sig = EventMachine.add_timer(time_out) {
          q << TimeoutError.new
        }
      end
      
      res = q.shift
      EventMachine.cancel_timer(em_sig)
      time_elapsed = ::Time.now - time_start
      logger.debug("Elapsed time for #{blk}: #{time_elapsed} secs") if time_elapsed > 0.05
      if res.is_a?(Exception)
        raise res
      end
      res
      
    end
def barrier(immediate=true, time_out=nil, &blk)
      if immediate && member_thread?
        return blk.call
      end
      
      q = ::Queue.new
      time_start = ::Time.now
      
      self.pass {
        begin
          q << blk.call
        rescue Exception => e
          q << e
        end
      }

      em_sig = nil
      if time_out
        em_sig = EventMachine.add_timer(time_out) {
          q << TimeoutError.new
        }
      end
      
      res = q.shift
      EventMachine.cancel_timer(em_sig)
      time_elapsed = ::Time.now - time_start
      logger.debug("Elapsed time for #{blk}: #{time_elapsed} secs") if time_elapsed > 0.05
      if res.is_a?(Exception)
        raise res
      end
      res
      
    end
Send a block to a worker thread similar with pass(). but this
 get the caller thread waited until the block proceeded in a
 worker thread.
 @param [Bool] immediage
 @param [Float] time_out
 @param [Proc] blk