다음을 통해 공유


Context Class

Represents an abstraction for an execution context.

class Context;

Members

Protected Constructors

Name

Description

Context::~Context Destructor

Public Methods

Name

Description

Context::Block Method

Blocks the current context.

Context::CurrentContext Method

Returns a pointer to the current context.

Context::GetId Method

Returns an identifier for the context that is unique within the scheduler to which the context belongs.

Context::GetScheduleGroupId Method

Returns an identifier for the schedule group that the context is currently working on.

Context::GetVirtualProcessorId Method

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

Context::Id Method

Returns an identifier for the current context that is unique within the scheduler to which the current context belongs.

Context::IsCurrentTaskCollectionCanceling Method

Returns an indication of whether the task collection which is currently executing inline on the current context is in the midst of an active cancellation (or will be shortly).

Context::IsSynchronouslyBlocked Method

Determines whether or not the context is synchronously blocked. A context is considered to be synchronously blocked if it explicitly performed an action which led to blocking.

Context::Oversubscribe Method

Injects an additional virtual processor into a scheduler for the duration of a block of code when invoked on a context executing on one of the virtual processors in that scheduler.

Context::ScheduleGroupId Method

Returns an identifier for the schedule group that the current context is working on.

Context::Unblock Method

Unblocks the context and causes it to become runnable.

Context::VirtualProcessorId Method

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

Context::Yield Method

Yields execution so that another context can execute. If no other context is available to yield to, the scheduler can yield to another operating system thread.

Remarks

The Concurrency Runtime scheduler (see Scheduler) uses execution contexts to execute the work queued to it by your application. A Win32 thread is an example of an execution context on a Windows operating system.

At any time, the concurrency level of a scheduler is equal to the number of virtual processors granted to it by the Resource Manager. A virtual processor is an abstraction for a processing resource and maps to a hardware thread on the underlying system. Only a single scheduler context can execute on a virtual processor at a given time.

The scheduler is cooperative in nature and an executing context can yield its virtual processor to a different context at any time if it wishes to enter a wait state. When its wait it satisfied, it cannot resume until an available virtual processor from the scheduler begins executing it.

Inheritance Hierarchy

Context

Requirements

Header: concrt.h

Namespace: concurrency

See Also

Reference

concurrency Namespace

Scheduler Class

Concepts

Task Scheduler (Concurrency Runtime)