def wait(watcher)
      future = Future.new
      # add watcher to loop
      id = Object.new
      watcher.set_callback {|err| future.transfer([id, err])}
      watcher.start(self)
      # trigger a fiber switch
      # wait until watcher is ok
      # then do work
      response_id, err = future.value
      current_beam = LightIO::Core::Beam.current
      if response_id != id
        raise LightIO::InvalidTransferError, "expect #{id}, but get #{response_id}"
      elsif err
        # if future return a err
        # simulate Thread#raise to Beam , that we can shutdown beam blocking by socket accepting
        # transfer back to which beam occur this err
        # not sure this is a right way to do it
        current_beam.raise(err) if current_beam.is_a?(LightIO::Core::Beam)
      end
      # check beam error after wait
      current_beam.send(:check_and_raise_error) if current_beam.is_a?(LightIO::Core::Beam)
    end
def wait(watcher)
      future = Future.new
      # add watcher to loop
      id = Object.new
      watcher.set_callback {|err| future.transfer([id, err])}
      watcher.start(self)
      # trigger a fiber switch
      # wait until watcher is ok
      # then do work
      response_id, err = future.value
      current_beam = LightIO::Core::Beam.current
      if response_id != id
        raise LightIO::InvalidTransferError, "expect #{id}, but get #{response_id}"
      elsif err
        # if future return a err
        # simulate Thread#raise to Beam , that we can shutdown beam blocking by socket accepting
        # transfer back to which beam occur this err
        # not sure this is a right way to do it
        current_beam.raise(err) if current_beam.is_a?(LightIO::Core::Beam)
      end
      # check beam error after wait
      current_beam.send(:check_and_raise_error) if current_beam.is_a?(LightIO::Core::Beam)
    end
Wait a watcher, watcher can be a timer or socket.
 see LightIO::Watchers module for detail