Thread.GetCurrentProcessorId 方法
定义
获取用于指示当前线程正在哪个处理器上执行的 ID。Gets an ID used to indicate on which processor the current thread is executing.
public:
static int GetCurrentProcessorId();
public static int GetCurrentProcessorId ();
static member GetCurrentProcessorId : unit -> int
Public Shared Function GetCurrentProcessorId () As Integer
返回
表示缓存的处理器 ID 的整数。An integer representing the cached processor ID.
注解
此值将被缓存并定期刷新。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.