# File lib/Borges/RequestHandler/Session.rb, line 155
  def in_thread(&block)
    val = nil

    if Thread.current[:in_handler_thread] then
      #val = handle_request(req)
      val = block.call

    else
      start_handler_thread unless defined? @thread

      @session_mutex.synchronize do
        response_lock = Mutex.new.lock # unlocked by #perform_request
        #@thread[:request] = req
        @thread[:block] = block
        @thread[:response_done] = response_lock
        @thread_mutex.unlock
        response_lock.lock
        val = @thread[:return]
      end

    end

    return val
  end