Прочитај на енглеском Уреди

Делите путем


MessageQueue.InfiniteTimeout Field

Definition

Specifies that no time-out exists for methods that peek or receive messages.

C#
public static readonly TimeSpan InfiniteTimeout;

Field Value

Examples

The following code example demonstrates the use of the InfiniteTimeout member.

C#
// Create a new message.
Message msg = new Message();

// Set the message's TimeToReachQueue property to
// MessageQueue.InfiniteTimeout.
msg.TimeToReachQueue = MessageQueue.InfiniteTimeout;

// Display the new value of the message's TimeToReachQueue property.
Console.WriteLine("Message.TimeToReachQueue: {0}",
    msg.TimeToReachQueue.ToString());

Remarks

MessageQueue supports two types of message retrieval: synchronous and asynchronous. The synchronous methods, Peek and Receive, cause the process thread to wait a specified time interval for a new message to arrive in the queue. If the specified time interval is InfiniteTimeout, the process thread remains blocked until a new message is available. On the other hand, BeginPeek and BeginReceive (the asynchronous methods), allow the main application tasks to continue in a separate thread until a message arrives in the queue.

Applies to

Производ Верзије
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also