Poll for the next message on one of the subscribed topics

 @param timeout_ms [Integer] Timeout of this poll

 @raise [RdkafkaError] When polling fails

 @return [Message, nil] A message or nil if there was no new message within the timeout
348300
def poll(timeout_ms)
      message_ptr = Rdkafka::Bindings.rd_kafka_consumer_poll(@native_kafka, timeout_ms)
      if message_ptr.null?
        nil
      else
        # Create struct wrapper
        native_message = Rdkafka::Bindings::Message.new(message_ptr)
        # Raise error if needed
        if native_message[:err] != 0
          raise Rdkafka::RdkafkaError.new(native_message[:err])
        end
        # Create a message to pass out
        Rdkafka::Consumer::Message.new(native_message)
      end
    ensure
      # Clean up rdkafka message if there is one
      if !message_ptr.nil? && !message_ptr.null?
        Rdkafka::Bindings.rd_kafka_message_destroy(message_ptr)
      end
    end
478175
async def poll_event(self):
        
        try:
            msg = await self.recv()
            await self.received_message(msg)
        except websockets.exceptions.ConnectionClosed as exc:
            if self._can_handle_close(exc.code):
                log.info('Websocket closed with %s (%s), attempting a reconnect.', exc.code, exc.reason)
                raise ResumeWebSocket(self.shard_id) from exc
            else:
                log.info('Websocket closed with %s (%s), cannot reconnect.', exc.code, exc.reason)
                raise ConnectionClosed(exc, shard_id=self.shard_id) from exc
311805
def send_with_reply_and_block(self, message, timeout = DBUS.TIMEOUT_USE_DEFAULT, error = None) :
        ""
        if not isinstance(message, Message) :
            raise TypeError("message must be a Message")
        #end if
        error, my_error = _get_error(error)
        reply = dbus.dbus_connection_send_with_reply_and_block(self._dbobj, message._dbobj, _get_timeout(timeout), error._dbobj)
        my_error.raise_if_set()
        if reply != None :
            result = Message(reply)
        else :
            result = None
        #end if
        return \
            result
1350377
def consume_one(timeout)
      msg = nil

      Rafka.wrap_errors do
        msg = @redis.blpop(@blpop_arg, timeout: timeout)
      end

      msg = Message.new(msg) if msg
      msg
    end
299930
def poll(self, timeout):
        
        timeout = float(timeout)
        end_time = time.time() + timeout
        while True:
            # Keep reading until data is received or timeout
            incoming = self.stream.read(self._max_read)
            if incoming:
                return incoming
            if (end_time - time.time()) < 0:
                raise ExpectTimeout()
            time.sleep(self._poll_period)
802242
public static Message buildSyncHistoryReply(int timeout) {
    ZabMessage.SyncHistoryReply reply =
      ZabMessage.SyncHistoryReply.newBuilder().setSyncTimeout(timeout).build();
    return Message.newBuilder().setType(MessageType.SYNC_HISTORY_REPLY)
                               .setSyncHistoryReply(reply).build();
  }
812693
def msg message, wait = true
      cmd_msg message
      return false unless wait_for(last_label) if wait
      return @response_args
    end
490196
def poll(self, timeout):
        
        now = time.time()
        end_time = now + float(timeout)
        prev_timeout = self.stream.gettimeout()
        self.stream.settimeout(self._poll_period)
        incoming = None
        try:
            while (end_time - now) >= 0:
                try:
                    incoming = self.stream.recv(self._max_read)
                except socket.timeout:
                    pass
                if incoming:
                    return incoming
                now = time.time()
            raise ExpectTimeout()
        finally:
            self.stream.settimeout(prev_timeout)
994286
def request(message)
      @mtx.synchronize do
        raise DeadActorError if not @running
        message = Message.coerce(message)
        raise ArgumentError, "use #terminate" if TERM == message[0]
        message.send_to(self)
        Message.receive_from(self)
      end
    rescue IO::EAGAINWaitWritable
      # same as in #<<
      retry
    end
1142379
def publish(topic, payload = '', retain = false, qos = 0)
      raise ArgumentError, 'Topic name cannot be nil' if topic.nil?
      raise ArgumentError, 'Topic name cannot be empty' if topic.empty?

      packet = MQTT::Packet::Publish.new(
        :id => next_packet_id,
        :qos => qos,
        :retain => retain,
        :topic => topic,
        :payload => payload
      )

      # Send the packet
      res = send_packet(packet)

      return if qos.zero?

      Timeout.timeout(@ack_timeout) do
        while connected?
          @pubacks_semaphore.synchronize do
            return res if @pubacks.delete(packet.id)
          end
          # FIXME: make threads communicate with each other, instead of polling
          # (using a pipe and select ?)
          sleep 0.01
        end
      end

      -1
    end
995116
def perform_request
      Timeout.timeout(request_timeout) do
        options = { read_timeout: request_timeout }

        if basic_auth_options.any?
          options[:http_basic_authentication] = basic_auth_options
        end

        url.read(options)
      end
    rescue => e
      raise ConnectionFailed, e
    end
1298920
function(ms,timeoutMsg)
				{
					timeoutMsg = timeoutMsg || "Timeout"
					var me = this;
					return new Zousan(function(resolve,reject) {

							setTimeout(function() {
									reject(Error(timeoutMsg));	// This will fail silently if promise already resolved or rejected
								}, ms);

							me.then(function(v) { resolve(v) },		// This will fail silently if promise already timed out
									function(er) { reject(er) });		// This will fail silently if promise already timed out

						})
				}
957008
def shutdown(timeout=5)
#       logger.debug { "#{self.class}##{__method__}" }

      @mutex.lock
      begin
        return true if @state == :shutdown

        @state = :shutdown
        @cond.broadcast
      ensure
        @mutex.unlock rescue nil
      end

      return true unless @thread 

      unless @thread.join(timeout) == @thread
        logger.error { "#{self.class} timed out waiting for dispatch thread, callback: #{callback.inspect}" }
        return false
      end

      true
    end
229310
def wait_for_no_keyboard(timeout: nil)
      keyboard_timeout = keyboard_wait_timeout(timeout)
      message = "Timed out after #{keyboard_timeout} seconds waiting for the keyboard to disappear"
      wait_for(message, timeout: keyboard_timeout) do
        !keyboard_visible?
      end
    end
869029
def check(timeout = nil, &block)
      message = nil

      @mutex.lock
      begin
        raise MailboxDead, "attempted to receive from a dead mailbox" if @dead

        message = nil
        Timers::Wait.for(timeout) do |remaining|
          message = next_message(&block)

          break if message

          @condition.wait(@mutex, remaining)
        end
      ensure
        begin
          @mutex.unlock
        rescue
          nil
        end
      end

      message
    end
447094
def reply(self, timeout=None):
        
        self._wait_on_signal(self._response_received)
        if self._response_exception is not None:
            msg = self._response_exception.message
            raise YamcsError(msg)
        return self._response_reply
1054581
def _blocking_poll(self, timeout=None):
        
        if self._result_set:
            return

        retry_ = self._retry.with_deadline(timeout)

        try:
            retry_(self._done_or_raise)()
        except exceptions.RetryError:
            raise concurrent.futures.TimeoutError(
                "Operation did not complete within the designated " "timeout."
            )