📄 concrt.h
字号:
/// <seealso cref="Scheduler Class"/>
/// <seealso cref="CurrentScheduler::Detach Method"/>
/// <seealso cref="Scheduler::Attach Method"/>
/**/
class nested_scheduler_missing_detach : public std::exception
{
public:
/// <summary>
/// Constructs a <c>nested_scheduler_missing_detach</c> object.
/// </summary>
/// <param name="_Message">
/// A descriptive message of the error.
/// </param>
/**/
explicit _CRTIMP nested_scheduler_missing_detach(const char * _Message) throw();
/// <summary>
/// Constructs a <c>nested_scheduler_missing_detach</c> object.
/// </summary>
/**/
_CRTIMP nested_scheduler_missing_detach() throw();
};
/// <summary>
/// This class describes an exception that is thrown when an operation has timed out.
/// </summary>
/**/
class operation_timed_out : public std::exception
{
public:
/// <summary>
/// Constructs an <c>operation_timed_out</c> object.
/// </summary>
/// <param name="_Message">
/// A descriptive message of the error.
/// </param>
/**/
explicit _CRTIMP operation_timed_out(const char * _Message) throw();
/// <summary>
/// Constructs an <c>operation_timed_out</c> object.
/// </summary>
/**/
_CRTIMP operation_timed_out() throw();
};
/// <summary>
/// This class describes an exception that is thrown when a <c>task_handle</c> object is scheduled multiple times
/// via the <c>run</c> method of a <c>task_group</c> or <c>structured_task_group</c> object without an intervening
/// call to either the <c>wait</c> or <c>run_and_wait</c> methods.
/// </summary>
/// <seealso cref="task_handle Class"/>
/// <seealso cref="task_group Class"/>
/// <seealso cref="task_group::run Method"/>
/// <seealso cref="task_group::wait Method"/>
/// <seealso cref="task_group::run_and_wait Method"/>
/// <seealso cref="structured_task_group Class"/>
/// <seealso cref="structured_task_group::run Method"/>
/// <seealso cref="structured_task_group::wait Method"/>
/// <seealso cref="structured_task_group::run_and_wait Method"/>
/**/
class invalid_multiple_scheduling : public std::exception
{
public:
/// <summary>
/// Constructs an <c>invalid_multiple_scheduling</c> object.
/// </summary>
/// <param name="_Message">
/// A descriptive message of the error.
/// </param>
/**/
explicit _CRTIMP invalid_multiple_scheduling(const char * _Message) throw();
/// <summary>
/// Constructs an <c>invalid_multiple_scheduling</c> object.
/// </summary>
/**/
_CRTIMP invalid_multiple_scheduling() throw();
};
/// <summary>
/// This class describes an exception that is thrown when the <c>Context::Oversubscribe</c> method is called with
/// the <paramref name="_BeginOversubscription"/> parameter set to <c>false</c> without a prior call to the
/// <c>Context::Oversubscribe</c> method with the <paramref name="_BeginOversubscription"/> parameter set to <c>true</c>.
/// </summary>
/// <seealso cref="Context::Oversubscribe Method"/>
/**/
class invalid_oversubscribe_operation : public std::exception
{
public:
/// <summary>
/// Constructs an <c>invalid_oversubscribe_operation</c> object.
/// </summary>
/// <param name="_Message">
/// A descriptive message of the error.
/// </param>
/**/
explicit _CRTIMP invalid_oversubscribe_operation(const char * _Message) throw();
/// <summary>
/// Constructs an <c>invalid_oversubscribe_operation</c> object.
/// </summary>
/**/
_CRTIMP invalid_oversubscribe_operation() throw();
};
/// <summary>
/// This class describes an exception that is thrown whenever a lock is acquired improperly.
/// </summary>
/// <remarks>
/// Typically, this exception is thrown when an attempt is made to acquire a non-reentrant lock
/// recursively on the same context.
/// </remarks>
/// <seealso cref="critical_section Class"/>
/// <seealso cref="reader_writer_lock Class"/>
/**/
class improper_lock : public std::exception
{
public:
/// <summary>
/// Constructs an <c>improper_lock exception</c>.
/// </summary>
/// <param name="_Message">
/// A descriptive message of the error.
/// </param>
/**/
explicit _CRTIMP improper_lock(const char * _Message) throw();
/// <summary>
/// Constructs an <c>improper_lock</c> exception.
/// </summary>
/**/
_CRTIMP improper_lock() throw();
};
/// <summary>
/// An elementary abstraction for a task, defined as <c>void (__cdecl * TaskProc)(void *)</c>. A <c>TaskProc</c> is called to
/// invoke the body of a task.
/// </summary>
/**/
typedef void (__cdecl * TaskProc)(void *);
/// <summary>
/// Represents an abstraction for a schedule group. Schedule groups organize a set of related work that benefits from being
/// scheduled close together either temporally, by executing another task in the same group before moving to another group, or
/// spatially, by executing multiple items within the same group on the same NUMA node or physical socket.
/// </summary>
/// <seealso cref="CurrentScheduler Class"/>
/// <seealso cref="Scheduler Class"/>
/// <seealso cref="Task Scheduler (Concurrency Runtime)"/>
/**/
class ScheduleGroup
{
public:
/// <summary>
/// Schedules a light-weight task within the schedule group.
/// </summary>
/// <param name="_Proc">
/// A pointer to the function to execute to perform the body of the light-weight task.
/// </param>
/// <param name="_Data">
/// A void pointer to the data that will be passed as a parameter to the body of the task.
/// </param>
/// <remarks>
/// Calling the <c>ScheduleTask</c> method implicitly places a reference count on the schedule group which is removed by the runtime
/// at an appropriate time after the task executes.
/// </remarks>
/// <seealso cref="ScheduleGroup::Reference Method"/>
/**/
virtual void ScheduleTask(TaskProc _Proc, void * _Data) =0;
/// <summary>
/// Returns an identifier for the schedule group that is unique within the scheduler to which the group belongs.
/// </summary>
/// <returns>
/// An identifier for the schedule group that is unique within the scheduler to which the group belongs.
/// </returns>
/**/
virtual unsigned int Id() const =0;
/// <summary>
/// Increments the schedule group's reference count.
/// </summary>
/// <returns>
/// The newly incremented reference count.
/// </returns>
/// <remarks>
/// This is typically used to manage the lifetime of the schedule group for composition. When the reference count of a schedule
/// group falls to zero, the schedule group is deleted by the runtime. A schedule group created using either the
/// <see cref="CurrentScheduler::CreateScheduleGroup Method">CurrentScheduler::CreateScheduleGroup</see> method, or the
/// <see cref="Scheduler::CreateScheduleGroup Method">Scheduler::CreateScheduleGroup</see> method starts out with a reference
/// count of one.
/// </remarks>
/// <seealso cref="ScheduleGroup::Release Method"/>
/// <seealso cref="CurrentScheduler::CreateScheduleGroup Method"/>
/// <seealso cref="Scheduler::CreateScheduleGroup Method"/>
/**/
virtual unsigned int Reference() =0;
/// <summary>
/// Decrements this scheduler group's reference count.
/// </summary>
/// <returns>
/// The newly decremented reference count.
/// </returns>
/// <remarks>
/// This is typically used to manage the lifetime of the schedule group for composition. When the reference count of a schedule
/// group falls to zero, the schedule group is deleted by the runtime. Once you have called the <c>Release</c> method the specific number
/// of times to remove the creation reference count and any additional references placed via the <c>Reference</c> method, you may not
/// utilize the schedule group further. Doing so will result in undefined behavior.
/// <para>A schedule group is associated with a particular scheduler instance. You must ensure that all references to the
/// schedule group are released before all references to the scheduler are released, since the latter could result in the scheduler
/// being destroyed. Doing otherwise results in undefined behavior.</para>
/// </remarks>
/// <seealso cref="ScheduleGroup::Reference Method"/>
/// <seealso cref="CurrentScheduler::CreateScheduleGroup Method"/>
/// <seealso cref="Scheduler::CreateScheduleGroup Method"/>
/**/
virtual unsigned int Release() =0;
protected:
//
// Privatize operator delete. Clients should utilize Release to relinquish a schedule group.
//
template<class _T> friend void Concurrency::details::_InternalDeleteHelper(_T * _PObject);
/// <summary>
/// A <c>ScheduleGroup</c> object is destroyed internally by the runtime when all external references to it are released.
/// It may not be explicitly deleted.
/// </summary>
/// <param name="_PObject">
/// A pointer to the object to be deleted.
/// </param>
/**/
void operator delete(void * _PObject)
{
::operator delete(_PObject);
}
};
/// <summary>
/// Special value for the policy keys <c>MinConcurrency</c> and <c>MaxConcurrency</c>. Defaults to the number of hardware
/// threads on the machine in the absence of other constraints.
/// </summary>
/// <seealso cref="PolicyElementKey Enumeration"/>
/**/
const unsigned int MaxExecutionResources = 0xFFFFFFFF;
/// <summary>
/// Special value for the policy key <c>ContextPriority</c> indicating that the thread priority of all contexts in the scheduler
/// should be the same as that of the thread which created the scheduler.
/// </summary>
/// <seealso cref="PolicyElementKey Enumeration"/>
/**/
const unsigned int INHERIT_THREAD_PRIORITY = 0x0000F000;
/// <summary>
/// Policy keys describing aspects of scheduler behavior. Each policy element is described by a key-value pair. For more information
/// about scheduler policies and their impact on schedulers, see <see cref="Task Scheduler (Concurrency Runtime)"/>.
/// </summary>
/// <seealso cref="SchedulerPolicy Class"/>
/// <seealso cref="CurrentScheduler Class"/>
/// <seealso cref="Scheduler Class"/>
/// <seealso cref="Task Scheduler (Concurrency Runtime)"/>
/**/
enum PolicyElementKey
{
/// <summary>
/// The type of threads that the scheduler will utilize for underlying execution contexts. For more information, see
/// <see cref="SchedulerType Enumeration"/>.
/// <para>Valid values : A member of the <c>SchedulerType</c> enumeration, either <c>ThreadScheduler</c> or <c>UmsThreadDefault</c></para>
/// <para>Default value : <c>ThreadScheduler</c>. This translates to Win32 threads on all operating systems.</para>
/// </summary>
/**/
SchedulerKind,
/// <summary>
/// The maximum concurrency level desired by the scheduler. The resource manager will try to initially allocate this many virtual processors.
/// The special value <see cref="MaxExecutionResources Constant">MaxExecutionResources</see> indicates that the desired concurrency level
/// is same as the number of hardware threads on the machine. If the value specified for <c>MinConcurrency</c> is greater than the number
/// of hardware threads on the machine and <c>MaxConcurrency</c> is specified as <c>MaxExecutionResources</c>, the value for <c>MaxConcurrency</c>
/// is raised to match what is set for <c>MinConcurrency</c>.
/// <para>Valid values : Positive integers and the special value <c>MaxExecutionResources</c></para>
/// <para>Default value : <c>MaxExecutionResources</c></para>
/// </summary>
/**/
MaxConcurrency,
/// <summary>
/// The minimum concurrency level that must be provided to the scheduler by the resource manager. The number of virtual processors assigned
/// to a scheduler will never go below the minimum. The special value <see cref="MaxExecutionResources Constant">MaxExecutionResources</see>
/// indicates that the minimum concurrency level is same as the number of hardware threads on the machine. If the value specified for
/// <c>MaxConcurrency</c> is less than the number of hardware threads on the machine and <c>MinConcurrency</c> is specified as
/// <c>MaxExecutionResources</c>, the value for <c>MinConcurrency</c> is lowered to match what is set for <c>MaxConcurrency</c>.
/// <para>Valid values : Non-negative integers and the special value <c>MaxExecutionResources</c>. Note that for scheduler policies
/// used for the construction of Concurrency Runtime schedulers or any policy with the <c>SchedulerKind</c> policy key set to the value
/// <c>UMSThreadDefault</c>, the value <c>0</c> is invalid.</para>
/// <para>Default value : <c>1</c></para>
/// </summary>
/**/
MinConcurrency,
/// <summary>
/// Tentative number of virtual processors per hardware thread. The target oversubscription factor may be increased by the Resource Manager,
/// if necessary, to satisfy <c>MaxConcurrency</c> with the hardware threads on the machine.
/// <para>Valid values : Positive integers</para>
/// <para>Default value : <c>1</c></para>
/// </summary>
/**/
TargetOversubscriptionFactor,
/// <summary>
/// When the <c>SchedulingProtocol</c> policy key is set to the value <c>EnhanceScheduleGroupLocality</c>, this specifies the maximum number
/// of runnable contexts allowed to be cached in per virtual processor local queues. Such contexts will typically run in last-in-first-out
/// (LIFO) order on the virtual processor that caused them to become runnable. Note that this policy key has no meaning when the
/// <c>SchedulingProtocol</c> key is set to the value <c>EnhanceForwardProgress</c>.
/// <para>Valid values : Non-negative integers</para>
/// <para>Default value : <c>8</c></para>
/// </summary>
/**/
LocalContextCacheSize,
/// <summary>
/// The reserved stack size of each context in the scheduler in kilobytes.
/// <para>Valid values : Positive integers</para>
/// <para>Default value : <c>0</c>, indicating that the process' default value for stack size be used.</para>
/// </summary>
/**/
ContextStackSize,
/// <summary>
/// The operating system thread priority of each context in the scheduler. If this key is set to the value <see cref="INHERIT_THREAD_PRIORITY Constant">
/// INHERIT_THREAD_PRIORITY</see> the contexts in the scheduler will inherit the priority of the thread that created the scheduler.
/// <para>Valid values : Any of the valid values for the Windows <c>SetThreadPriority</c> function and the special value
/// <c>INHERIT_THREAD_PRIORITY</c></para>
/// <para>Default value : <c>THREAD_PRIORITY_NORMAL</c></para>
/// </summary>
/**/
ContextPriority,
/// <summary>
/// Describes which scheduling algorithm will be used by the scheduler. For more information, see <see cref="SchedulingProtocolType Enumeration"/>.
/// <para>Valid values : A member of the <c>SchedulingProtocolType</c> enumeration, either <c>EnhanceScheduleGroupLocality</c>
/// or <c>EnhanceForwardProgress</c></para>
/// <para>Default value : <c>EnhanceScheduleGroupLocality</c></para>
/// </summary>
/**/
SchedulingProtocol,
/// <summary>
/// Determines whether the resources for the scheduler will be rebalanced according to statistical information gathered from the
/// scheduler or only based on the subscription level of underlying hardware threads. For more information, see
/// <see cref="DynamicProgressFeedbackTy
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -