Freigeben über


Thread.Sleep Method

Definition

Overloads

Sleep(Int64)

Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers.

Sleep(Int64, Int32)

Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds plus the specified number of nanoseconds, subject to the precision and accuracy of system timers and schedulers.

Sleep(Int64)

Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers.

[Android.Runtime.Register("sleep", "(J)V", "")]
public static void Sleep (long millis);
[<Android.Runtime.Register("sleep", "(J)V", "")>]
static member Sleep : int64 -> unit

Parameters

millis
Int64

the length of time to sleep in milliseconds

Attributes

Exceptions

if the current thread has been interrupted. The interrupted status of the current thread will be cleared before the exception is thrown.

Remarks

Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers. The thread does not lose ownership of any monitors.

Java documentation for java.lang.Thread.sleep(long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to

Sleep(Int64, Int32)

Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds plus the specified number of nanoseconds, subject to the precision and accuracy of system timers and schedulers.

[Android.Runtime.Register("sleep", "(JI)V", "")]
public static void Sleep (long millis, int nanos);
[<Android.Runtime.Register("sleep", "(JI)V", "")>]
static member Sleep : int64 * int -> unit

Parameters

millis
Int64

the length of time to sleep in milliseconds

nanos
Int32

0-999999 additional nanoseconds to sleep

Attributes

Exceptions

if the current thread has been interrupted. The interrupted status of the current thread will be cleared before the exception is thrown.

Remarks

Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds plus the specified number of nanoseconds, subject to the precision and accuracy of system timers and schedulers. The thread does not lose ownership of any monitors.

Java documentation for java.lang.Thread.sleep(long, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to