Thread.GetCurrentProcessorId Method

Definition

Gets an ID used to indicate on which processor the current thread is executing.

C#
public static int GetCurrentProcessorId();

Returns

An integer representing the cached processor ID.

Remarks

This value is cached and periodically refreshed. It may be stale by the time it's used: consuming code must not rely on its accuracy for correctness.

The value is not guaranteed to be a zero-based processor number.

Applies to

Toode Versioonid
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1