STLdoc
STLdocumentation
|
Structured task collections represent groups of work which follow a strictly LIFO ordered paradigm queueing and waiting respectively. They can only be waited on once and can only be used from a single thread of execution. More...
#include <concrt.h>
Public Member Functions | |
_StructuredTaskCollection () | |
Construct a new structured task collection. More... | |
_StructuredTaskCollection (const _StructuredTaskCollection &)=delete | |
_StructuredTaskCollection & | operator= (const _StructuredTaskCollection &)=delete |
_CONCRTIMP | _StructuredTaskCollection (_CancellationTokenState *_PTokenState) |
Construct a new structured task collection whose cancellation is governed by the supplied cancellation token. More... | |
_CONCRTIMP | ~_StructuredTaskCollection () |
Destruct a task collection and wait on all associated work to finish. Clients must call '_StructuredTaskCollection::_Wait' or '_StructuredTaskCollection::_RunAndWait' prior to destructing the object. If there are chores remaining in the queues, an exception (missing_wait) is thrown. If the destructor is running because of exception unwinding, it will abort any scheduled work. If another exception occurs because work is aborted, the process will terminate (C++ semantics). More... | |
_CONCRTIMP void | _Schedule (_UnrealizedChore *_PChore, location *_PLocation) |
Schedules a chore that can potentially run in parallel. The chore is pushed onto the associated workstealing queue, and will be executed in a LIFO order. Note that the specified chore can be scheduled only on a single task collection at a given time. Any attempt to schedule the same chore multiple times on one or more task collection will result in an invalid_multiple_scheduling exception. After the chore is guaranteed to have been executed (by calling the _Wait method), it can be rescheduled to an arbitrary task collection. More... | |
_CONCRTIMP void | _Schedule (_UnrealizedChore *_PChore) |
Schedules a chore that can potentially run in parallel. The chore is pushed onto the associated workstealing queue, and will be executed in a LIFO order. Note that the specified chore can be scheduled only on a single task collection at a given time. Any attempt to schedule the same chore multiple times on one or more task collection will result in an invalid_multiple_scheduling exception. After the chore is guaranteed to have been executed (by calling the _Wait method), it can be rescheduled to an arbitrary task collection. More... | |
_CONCRTIMP void | _Cancel () |
Cancels work on the task collection. More... | |
_CONCRTIMP bool | _IsCanceling () |
Informs the caller whether or not the task collection is currently in the midst of cancellation. Note that this does not necessarily indicate that Cancel was called on the collection (although such certainly qualifies this function to return true). It can be the case that the task collection is executing inline and a task collection further up in the work tree was canceled. In cases such as these where we can determine ahead of time that cancellation will flow through this collection, true will be returned as well. More... | |
_CONCRTIMP _TaskCollectionStatus __stdcall | _RunAndWait (_UnrealizedChore *_PChore=NULL) |
A cancellation friendly wrapper with which to execute _PChore and then waits for all chores running in the _StructuredTaskCollection to finish (normally or abnormally). This method encapsulates all the running tasks in an exception handling block, and will re-throw any exceptions that occur in any of it tasks (if those exceptions occur on another thread, they are marshaled from that thread to the thread where the _StructuredTaskCollection was created, and re-thrown). After this function returns, the _StructuredTaskCollection cannot be used for scheduling further work. More... | |
_TaskCollectionStatus | _Wait () |
Waits for all chores running in the _StructuredTaskCollection to finish (normally or abnormally). This method encapsulates all the running tasks in an exception handling block, and will re-throw any exceptions that occur in any of it tasks (if those exceptions occur on another thread, they are marshaled from that thread to the thread where the _StructuredTaskCollection was created, and re-thrown). After this function returns, the _StructuredTaskCollection cannot be used for scheduling further work. More... | |
void | _CancelStolenContexts () |
Called to cancel any contexts which stole chores from the given collection. More... | |
Public Member Functions inherited from Concurrency::details::_TaskCollectionBase | |
_TaskCollectionBase () | |
_TaskCollectionBase (const _TaskCollectionBase &)=delete | |
_TaskCollectionBase (_CancellationTokenState *_PTokenState) | |
_TaskCollectionBase & | operator= (const _TaskCollectionBase &)=delete |
void * | _OwningContext () const |
int | _InliningDepth () const |
bool | _IsCurrentlyInlined () const |
bool | _IsStructured () |
_CancellationTokenState * | _GetTokenState (_CancellationTokenRegistration **_PRegistration=NULL) |
Private Member Functions | |
void | _Construct () |
_CONCRTIMP void | _Abort () |
Internal routine to abort work on the task collection. More... | |
_CONCRTIMP void | _CleanupToken () |
Internal routine to clean up after a cancellation token. More... | |
bool | _TaskCleanup () |
Performs task cleanup normally done at destruction time. More... | |
void | _Initialize () |
Internal initialization of the structured task collection More... | |
void | _WaitOnStolenChores (long _StolenChoreCount) |
Waits on a specified number of stolen chores. More... | |
void | _CountUp () |
Indicates that a stolen chore has completed. More... | |
Static Private Member Functions | |
static void __cdecl | _CancelViaToken (_StructuredTaskCollection *_PCollection) |
The callback which is made when a cancellation occurs via a token associated with a structured_task_group on the boundary of two cancellation tokens. More... | |
Private Attributes | |
_CONCRT_BUFFER | _M_event [(sizeof(void *)+sizeof(_CONCRT_BUFFER)-1)/sizeof(_CONCRT_BUFFER)] |
Friends | |
class | _UnrealizedChore |
Structured task collections represent groups of work which follow a strictly LIFO ordered paradigm queueing and waiting respectively. They can only be waited on once and can only be used from a single thread of execution.
|
inline |
Construct a new structured task collection.
|
delete |
_CONCRTIMP Concurrency::details::_StructuredTaskCollection::_StructuredTaskCollection | ( | _CancellationTokenState * | _PTokenState | ) |
Construct a new structured task collection whose cancellation is governed by the supplied cancellation token.
_PTokenState | When this cancellation token is canceled, the structured task group will be canceled. |
_CONCRTIMP Concurrency::details::_StructuredTaskCollection::~_StructuredTaskCollection | ( | ) |
Destruct a task collection and wait on all associated work to finish. Clients must call '_StructuredTaskCollection::_Wait' or '_StructuredTaskCollection::_RunAndWait' prior to destructing the object. If there are chores remaining in the queues, an exception (missing_wait) is thrown. If the destructor is running because of exception unwinding, it will abort any scheduled work. If another exception occurs because work is aborted, the process will terminate (C++ semantics).
|
private |
Internal routine to abort work on the task collection.
_CONCRTIMP void Concurrency::details::_StructuredTaskCollection::_Cancel | ( | ) |
Cancels work on the task collection.
void Concurrency::details::_StructuredTaskCollection::_CancelStolenContexts | ( | ) |
Called to cancel any contexts which stole chores from the given collection.
|
staticprivate |
The callback which is made when a cancellation occurs via a token associated with a structured_task_group on the boundary of two cancellation tokens.
|
private |
Internal routine to clean up after a cancellation token.
|
inlineprivate |
|
private |
Indicates that a stolen chore has completed.
|
private |
Internal initialization of the structured task collection
_CONCRTIMP bool Concurrency::details::_StructuredTaskCollection::_IsCanceling | ( | ) |
Informs the caller whether or not the task collection is currently in the midst of cancellation. Note that this does not necessarily indicate that Cancel was called on the collection (although such certainly qualifies this function to return true). It can be the case that the task collection is executing inline and a task collection further up in the work tree was canceled. In cases such as these where we can determine ahead of time that cancellation will flow through this collection, true will be returned as well.
_CONCRTIMP _TaskCollectionStatus __stdcall Concurrency::details::_StructuredTaskCollection::_RunAndWait | ( | _UnrealizedChore * | _PChore = NULL | ) |
A cancellation friendly wrapper with which to execute _PChore and then waits for all chores running in the _StructuredTaskCollection to finish (normally or abnormally). This method encapsulates all the running tasks in an exception handling block, and will re-throw any exceptions that occur in any of it tasks (if those exceptions occur on another thread, they are marshaled from that thread to the thread where the _StructuredTaskCollection was created, and re-thrown). After this function returns, the _StructuredTaskCollection cannot be used for scheduling further work.
_PChore | An _UnrealizedChore which when non-null will be called to invoke the chore in a cancellation friendly manner. |
_CONCRTIMP void Concurrency::details::_StructuredTaskCollection::_Schedule | ( | _UnrealizedChore * | _PChore, |
location * | _PLocation | ||
) |
Schedules a chore that can potentially run in parallel. The chore is pushed onto the associated workstealing queue, and will be executed in a LIFO order. Note that the specified chore can be scheduled only on a single task collection at a given time. Any attempt to schedule the same chore multiple times on one or more task collection will result in an invalid_multiple_scheduling exception. After the chore is guaranteed to have been executed (by calling the _Wait method), it can be rescheduled to an arbitrary task collection.
_PChore | The new unrealized chore to schedule |
_PLocation | The location where the unrealized chore should execute. Specifying the value NULL here indicates that the unrealized chore does not have specific placement. |
_CONCRTIMP void Concurrency::details::_StructuredTaskCollection::_Schedule | ( | _UnrealizedChore * | _PChore | ) |
Schedules a chore that can potentially run in parallel. The chore is pushed onto the associated workstealing queue, and will be executed in a LIFO order. Note that the specified chore can be scheduled only on a single task collection at a given time. Any attempt to schedule the same chore multiple times on one or more task collection will result in an invalid_multiple_scheduling exception. After the chore is guaranteed to have been executed (by calling the _Wait method), it can be rescheduled to an arbitrary task collection.
_PChore | The new unrealized chore to schedule |
|
inlineprivate |
Performs task cleanup normally done at destruction time.
|
inline |
Waits for all chores running in the _StructuredTaskCollection to finish (normally or abnormally). This method encapsulates all the running tasks in an exception handling block, and will re-throw any exceptions that occur in any of it tasks (if those exceptions occur on another thread, they are marshaled from that thread to the thread where the _StructuredTaskCollection was created, and re-thrown). After this function returns, the _StructuredTaskCollection cannot be used for scheduling further work.
|
private |
Waits on a specified number of stolen chores.
_StolenChoreCount | The number of stolen chores to wait on. |
|
delete |
|
friend |
|
private |