共用方式為


Context::GetVirtualProcessorId Method

Returns an identifier for the virtual processor that the context is currently executing on.

virtual unsigned int GetVirtualProcessorId() const =0;

Return Value

If the context is currently executing on a virtual processor, an identifier for the virtual processor that the context is currently executing on; otherwise, the value -1.

Remarks

The return value from this method is an instantaneous sampling of the virtual processor that the context is executing on. This value can be stale the moment it is returned and cannot be relied upon. Typically, this method is used for debugging or tracing purposes only.

Requirements

Header: concrt.h

Namespace: concurrency

See Also

Reference

Context Class