# File lib/autumn/stem.rb, line 499
    def start
      # Synchronous (mutual exclusion) message processing is handled by a
      # producer-consumer approach. The socket pushes messages onto this queue,
      # which are processed by a consumer thread one at a time.
      @messages = Queue.new
      @message_consumer = Thread.new do
        loop do
          meths = @messages.pop
          begin
            meths.each { |meth, args| broadcast_sync meth, *args }
          rescue
            options[:logger].error $!
          end
        end
      end
      
      @socket = connect
      username = @options[:user]
      username ||= @nick
      realname = @options[:name]
      realname ||= @nick
    
      pass @options[:server_password] if @options[:server_password]
      user username, @nick, @nick, realname
      nick @nick
      
      while line = @socket.gets
        meths = receive line # parse the line and get a list of methods to call
        @messages.push meths # push the methods on the queue; the consumer thread will execute all the synchronous methods
        # then execute all the other methods in their own thread
        meths.each { |meth, args| broadcast meth, *args }
      end
    end