CurrentScheduler::Create Method
Creates a new scheduler whose behavior is described by the _Policy parameter and attaches it to the calling context. The newly created scheduler will become the current scheduler for the calling context.
static void __cdecl Create(
const SchedulerPolicy& _Policy
);
Parameters
- _Policy
The scheduler policy that describes the behavior of the newly created scheduler.
Remarks
The attachment of the scheduler to the calling context implicitly places a reference count on the scheduler.
After a scheduler is created with the Create method, you must call the CurrentScheduler::Detach method at some point in the future in order to allow the scheduler to shut down.
If this method is called from a context that is already attached to a different scheduler, the existing scheduler is remembered as the previous scheduler, and the newly created scheduler becomes the current scheduler. When you call the CurrentScheduler::Detach method at a later point, the previous scheduler is restored as the current scheduler.
This method can throw a variety of exceptions, including scheduler_resource_allocation_error and invalid_scheduler_policy_value.
Requirements
Header: concrt.h
Namespace: concurrency
See Also
Reference
CurrentScheduler::Detach Method