Scheduler::Create Method

Creates a new scheduler whose behavior is described by the _Policy parameter, places an initial reference on the scheduler, and returns a pointer to it.

_CRTIMP static Scheduler * __cdecl Create(
   const SchedulerPolicy& _Policy
);

Parameters

  • _Policy
    The scheduler policy that describes behavior of the newly created scheduler.

Return Value

A pointer to a newly created scheduler. This Scheduler object has an initial reference count placed on it.

Remarks

After a scheduler is created with the Create method, you must call the Release method at some point in the future in order to remove the initial reference count and allow the scheduler to shut down.

A scheduler created with this method is not attached to the calling context. It may be attached to a context via the Attach method.

This method may throw a variety of exceptions, including scheduler_resource_allocation_error and invalid_scheduler_policy_value.

Requirements

Header: concrt.h

Namespace: Concurrency

See Also

Reference

Scheduler Class

Scheduler::Release Method

Scheduler::Attach Method

CurrentScheduler::Create Method

PolicyElementKey Enumeration

Concepts

Task Scheduler (Concurrency Runtime)