/// <summary> /// Try to dequeue an item from the queue. Dequeueing and item is not thread safe. /// </summary> /// <param name="result">Will be filled with the item upon success</param> /// <param name="timeout">Timeout to try and dequeue and item</param> /// <returns>Will return false if it didn't succeed to dequeue an item after the timeout.</returns> public bool TryDequeue(out T result, TimeSpan timeout) { if (m_reader.TryReceive(ref m_dequeueMsg, timeout)) { return(m_queue.TryDequeue(out result)); } else { result = default(T); return(false); } }
/// <summary> /// Attempt to receive a message for the specified period of time, returning true if successful or false if it times-out. /// </summary> /// <param name="msg">a <c>Msg</c> to write the received message into</param> /// <param name="timeout">a <c>TimeSpan</c> specifying how long to block, waiting for a message, before timing out</param> /// <returns>true only if a message was indeed received</returns> public bool TryReceive(ref Msg msg, TimeSpan timeout) { return(m_self.TryReceive(ref msg, timeout)); }
public bool TryReceive(ref Msg msg, TimeSpan timeout) { return(m_messagesPipe.TryReceive(ref msg, timeout)); }