Поделиться через


Context Class

Represents an abstraction for an execution context.

class Context;

Members

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 may execute. If no other context is available to yield to, the scheduler may yield to another operating system thread.

Protected Operators

Name

Description

Context::operator delete Operator

A Context object is destroyed internally by the runtime. It may not be explicitly deleted.

Remarks

The Concurrency Runtime scheduler (see Scheduler) uses execution contexts to execute the work queued to it by your application. A Win32 thread and a user mode schedulable (UMS) thread are examples of execution contexts on a Windows operating system. UMS threads are supported only on 64-bit operating systems with version Windows 7 and higher.

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 may execute on a virtual processor at a given time.

The scheduler is cooperative in nature and an executing context may 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)