Mono Class Library: System.Threading.Thread Overview | Members

System.Threading.Thread.Sleep Method

Blocks the current thread for a specified time.

public static void Sleep (TimeSpan timeout)

Parameters

timeout
A TimeSpan set to the amount of time for which the current thread will be blocked. Specify zero to indicate that this thread should be suspended temporarily to allow other waiting threads to execute. Specify Timeout.Infinite milliseconds to suspend the thread indefinitely.

Exceptions

TypeReason
ArgumentOutOfRangeExceptionThe value of timeout is negative and is not equal to Timeout.Infinite milliseconds, or is greater than int.MaxValue milliseconds.

Remarks

This method converts timeout to milliseconds, tests the validity of the converted value, and calls Thread.Sleep(int)(int).

The thread will not be scheduled for execution by the operating system for the amount of time specified. This method changes the state of the thread to include ThreadState.WaitSleepJoin.

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0