STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
Concurrency Namespace Reference

The Concurrency namespace provides classes and functions that provide access to the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime. More...

Namespaces

 details
 
 direct3d
 
 fast_math
 Functions in the fast_math namespace have lower accuracy, and support only single-precision float.
 
 graphics
 
 precise_math
 Functions in the precise_math namespace have higher accuracy, but require double-precision support, which not all accelerators do.
 

Classes

class  _AllocatedBufferHolder
 
struct  _Binary_transform_impl_helper
 
struct  _Binary_transform_impl_helper< std::random_access_iterator_tag, std::random_access_iterator_tag, std::random_access_iterator_tag >
 
class  _Continuation_func_transformer
 A helper class template that transforms a continuation lambda that either takes or returns void, or both, into a lambda that takes and returns a non-void type (details::_Unit_type is used to substitute for void). This is to minimize the special handling required for 'void'. More...
 
class  _Continuation_func_transformer< _InType, void >
 
class  _Continuation_func_transformer< void, _OutType >
 
class  _Continuation_func_transformer< void, void >
 
class  _Greedy_node
 Helper class used in multi-type greedy join blocks Ordered node is a single-target, single-source ordered propagator block More...
 
class  _Init_func_transformer
 
class  _Init_func_transformer< void >
 
class  _Iterator_helper
 
class  _Iterator_helper< _Random_iterator, std::random_access_iterator_tag >
 
class  _Join_node
 Defines a block allowing sources of distinct types to be joined. Join node is a single-target, multi-source ordered propagator block More...
 
class  _Network_link_iterator
 Const iterator for network link registry. Message blocks should use the link_registry::iterator type for iteration. More...
 
class  _Non_greedy_node
 Helper class used in multi-type non-greedy join blocks Ordered node is a single-target, single-source ordered propagator block More...
 
class  _Order_combinable
 
class  _Order_node_base
 Base class for Helper node used in multi-type join and choice blocks Order node is a single-target, single-source ordered propagator block The main property of an order node is that it accepts a message of _Type and outputs a message of int, with some unique assigned index number. More...
 
class  _Parallel_chunk_helper
 
class  _Parallel_chunk_helper_invoke
 
class  _Parallel_chunk_helper_invoke< _Random_iterator, _Index_type, _Function, false >
 
class  _Parallel_fixed_chunk_helper
 
class  _Parallel_for_each_helper
 
class  _Parallel_localized_chunk_helper
 
class  _Parallel_reduce_fixed_worker
 
struct  _Parallel_reduce_forward_executor_helper
 
class  _Parallel_transform_binary_helper
 
class  _Parallel_transform_unary_helper
 
struct  _Radix_sort_default_function
 
class  _Range
 
struct  _Reduce_functor_helper
 
class  _Reserving_node
 Helper class used in multi-type choice blocks Ordered node is a single-target, single-source ordered propagator block More...
 
class  _Source_link_iterator
 Const Iterator for referenced link manager. More...
 
class  _Tiled_index_base
 A _Tiled_index_base is the base class of all three kinds of tiled_index to share the common code. More...
 
struct  _Unary_transform_impl_helper
 
struct  _Unary_transform_impl_helper< std::random_access_iterator_tag, std::random_access_iterator_tag >
 
struct  _Unwrap
 
struct  _Unwrap< std::tuple< _Types...> >
 Template specialization used to unwrap the types from within a tuple. More...
 
class  _Worker_proxy
 
class  accelerator
 Class represents a accelerator abstraction for C++ AMP data-parallel devices More...
 
class  accelerator_view
 Class represents a virtual device abstraction on a C++ AMP data-parallel accelerator More...
 
class  accelerator_view_removed
 Exception thrown when an underlying DirectX call fails due to the Windows timeout detection and recovery mechanism More...
 
class  affinity_partitioner
 The affinity_partitioner class is similar to the static_partitioner class, but it improves cache affinity by its choice of mapping subranges to worker threads. It can improve performance significantly when a loop is re-executed over the same data set, and the data fits in cache. Note that the same affinity_partitioner object must be used with subsequent iterations of a parallel loop that is executed over a particular data set, to benefit from data locality. More...
 
class  agent
 A class intended to be used as a base class for all independent agents. It is used to hide state from other agents and interact using message-passing. More...
 
class  array
 An array is a multi-dimensional data aggregate on a accelerator_view. More...
 
class  array_view
 An array_view is an N-dimensional view over data held in another container (such as array<T,N> or other container. It exposes an indexing interface congruent to that of array<T,N>). More...
 
class  array_view< const _Value_type, _Rank >
 
class  auto_partitioner
 The auto_partitioner class represents the default method parallel_for, parallel_for_each and parallel_transform use to partition the range they iterates over. This method of partitioning employes range stealing for load balancing as well as per-iterate cancellation. More...
 
class  await_resume_context
 
class  bad_target
 This class describes an exception thrown when a messaging block is given a pointer to a target which is invalid for the operation being performed. More...
 
class  call
 A call messaging block is a multi-source, ordered target_block that invokes a specified function when receiving a message. More...
 
class  cancellation_token
 The cancellation_token class represents the ability to determine whether some operation has been requested to cancel. A given token can be associated with a task_group, structured_task_group, or task to provide implicit cancellation. It can also be polled for cancellation or have a callback registered for if and when the associated cancellation_token_source is canceled. More...
 
class  cancellation_token_registration
 The cancellation_token_registration class represents a callback notification from a cancellation_token. When the register method on a cancellation_token is used to receive notification of when cancellation occurs, a cancellation_token_registration object is returned as a handle to the callback so that the caller can request a specific callback no longer be made through use of the deregister method. More...
 
class  cancellation_token_source
 The cancellation_token_source class represents the ability to cancel some cancelable operation. More...
 
class  choice
 A choice messaging block is a multi-source, single-target block that represents a control-flow interaction with a set of sources. The choice block will wait for any one of multiple sources to produce a message and will propagate the index of the source that produced the message. More...
 
class  combinable
 The combinable<T> object is intended to provide thread-private copies of data, to perform lock-free thread-local sub-computations during parallel algorithms. At the end of the parallel operation, the thread-private sub-computations can then be merged into a final result. This class can be used instead of a shared variable, and can result in a performance improvement if there would otherwise be a lot of contention on that shared variable. More...
 
class  completion_future
 Class represents a future corresponding to a C++ AMP asynchronous operation More...
 
class  concurrent_priority_queue
 The concurrent_priority_queue class is a container that allows multiple threads to concurrently push and pop items. Items are popped in priority order where priority is determined by a functor supplied as a template argument. More...
 
class  concurrent_queue
 The concurrent_queue class is a sequence container class that allows first-in, first-out access to its elements. It enables a limited set of concurrency-safe operations, such as push and try_pop. More...
 
class  concurrent_unordered_map
 The concurrent_unordered_map class is a concurrency-safe container that controls a varying-length sequence of elements of type std::pair<const _Key_type, _Element_type>. The sequence is represented in a way that enables concurrency-safe append, element access, iterator access, and iterator traversal operations. More...
 
class  concurrent_unordered_multimap
 The concurrent_unordered_multimap class is an concurrency-safe container that controls a varying-length sequence of elements of type std::pair<const _Key_type, _Element_type>. The sequence is represented in a way that enables concurrency-safe append, element access, iterator access and iterator traversal operations. More...
 
class  concurrent_unordered_multiset
 The concurrent_unordered_multiset class is an concurrency-safe container that controls a varying-length sequence of elements of type _Key_type. The sequence is represented in a way that enables concurrency-safe append, element access, iterator access and iterator traversal operations. More...
 
class  concurrent_unordered_set
 The concurrent_unordered_set class is an concurrency-safe container that controls a varying-length sequence of elements of type _Key_type. The sequence is represented in a way that enables concurrency-safe append, element access, iterator access and iterator traversal operations. More...
 
class  concurrent_vector
 The concurrent_vector class is a sequence container class that allows random access to any element. It enables concurrency-safe append, element access, iterator access, and iterator traversal operations. More...
 
class  context_self_unblock
 This class describes an exception thrown when the Unblock method of a Context object is called from the same context. This would indicate an attempt by a given context to unblock itself. More...
 
class  context_unblock_unbalanced
 This class describes an exception thrown when calls to the Block and Unblock methods of a Context object are not properly paired. More...
 
class  critical_section
 A non-reentrant mutex which is explicitly aware of the Concurrency Runtime. More...
 
class  default_scheduler_exists
 This class describes an exception thrown when the Scheduler::SetDefaultSchedulerPolicy method is called when a default scheduler already exists within the process. More...
 
class  event
 A manual reset event which is explicitly aware of the Concurrency Runtime. More...
 
class  extent
 The extent<N> type represents an N-dimensional vector of int which specifies the bounds of an N-dimensional space with an origin of 0. The values in the coordinate vector are ordered from most-significant to least-significant. Thus, in 2-dimensional space, the extent vector (5,3) represents a space with 5 rows and 3 columns. More...
 
class  improper_lock
 This class describes an exception thrown when a lock is acquired improperly. More...
 
class  improper_scheduler_attach
 This class describes an exception thrown when the Attach method is called on a Scheduler object which is already attached to the current context. More...
 
class  improper_scheduler_detach
 This class describes an exception thrown when the CurrentScheduler::Detach method is called on a context which has not been attached to any scheduler using the Attach method of a Scheduler object. More...
 
class  improper_scheduler_reference
 This class describes an exception thrown when the Reference method is called on a Scheduler object that is shutting down, from a context that is not part of that scheduler. More...
 
class  index
 Define an N-dimensional index point; which may also be viewed as a vector based at the origin in N-space. More...
 
class  invalid_compute_domain
 Exception thrown when the runtime fails to launch a kernel using the compute domain specified at the parallel_for_each call site. More...
 
class  invalid_link_target
 This class describes an exception thrown when the link_target method of a messaging block is called and the messaging block is unable to link to the target. This can be the result of exceeding the number of links the messaging block is allowed or attempting to link a specific target twice to the same source. More...
 
class  invalid_multiple_scheduling
 This class describes an exception thrown when a task_handle object is scheduled multiple times using the run method of a task_group or structured_task_group object without an intervening call to either the wait or run_and_wait methods. More...
 
class  invalid_operation
 This class describes an exception thrown when an invalid operation is performed that is not more accurately described by another exception type thrown by the Concurrency Runtime. More...
 
class  invalid_oversubscribe_operation
 This class describes an exception thrown when the Context::Oversubscribe method is called with the _BeginOversubscription parameter set to false without a prior call to the Context::Oversubscribe method with the _BeginOversubscription parameter set to true. More...
 
class  invalid_scheduler_policy_key
 This class describes an exception thrown when an invalid or unknown key is passed to a SchedulerPolicy object constructor, or the SetPolicyValue method of a SchedulerPolicy object is passed a key that must be changed using other means such as the SetConcurrencyLimits method. More...
 
class  invalid_scheduler_policy_thread_specification
 This class describes an exception thrown when an attempt is made to set the concurrency limits of a SchedulerPolicy object such that the value of the MinConcurrency key is less than the value of the MaxConcurrency key. More...
 
class  invalid_scheduler_policy_value
 This class describes an exception thrown when a policy key of a SchedulerPolicy object is set to an invalid value for that key. More...
 
class  ISource
 The ISource class is the interface for all source blocks. Source blocks propagate messages to ITarget blocks. More...
 
class  ITarget
 The ITarget class is the interface for all target blocks. Target blocks consume messages offered to them by ISource blocks. More...
 
class  join
 A join messaging block is a single-target, multi-source, ordered propagator_block which combines together messages of type _Type from each of its sources. More...
 
class  location
 An abstraction of a physical location on hardware. More...
 
class  message
 The basic message envelope containing the data payload being passed between messaging blocks. More...
 
class  message_not_found
 This class describes an exception thrown when a messaging block is unable to find a requested message. More...
 
class  message_processor
 The message_processor class is the abstract base class for processing of message objects. There is no guarantee on the ordering of the messages. More...
 
class  missing_wait
 This class describes an exception thrown when there are tasks still scheduled to a task_group or structured_task_group object at the time that object's destructor executes. This exception will never be thrown if the destructor is reached because of a stack unwinding as the result of an exception. More...
 
class  multi_link_registry
 The multi_link_registry object is a network_link_registry that manages multiple source blocks or multiple target blocks. More...
 
class  multitype_join
 A multitype_join messaging block is a multi-source, single-target messaging block that combines together messages of different types from each of its sources and offers a tuple of the combined messages to its targets. More...
 
class  nested_scheduler_missing_detach
 This class describes an exception thrown when the Concurrency Runtime detects that you neglected to call the CurrentScheduler::Detach method on a context that attached to a second scheduler using the Attach method of the Scheduler object. More...
 
class  network_link_registry
 The network_link_registry abstract base class manages the links between source and target blocks. More...
 
class  operation_timed_out
 This class describes an exception thrown when an operation has timed out. More...
 
class  ordered_message_processor
 An ordered_message_processor is a message_processor that allows message blocks to process messages in the order they were received. More...
 
class  out_of_memory
 Exception thrown when an underlying OS/DirectX call fails due to lack of system or device memory More...
 
class  overwrite_buffer
 An overwrite_buffer messaging block is a multi-target, multi-source, ordered propagator_block capable of storing a single message at a time. New messages overwrite previously held ones. More...
 
class  propagator_block
 The propagator_block class is an abstract base class for message blocks that are both a source and target. It combines the functionality of both the source_block and target_block classes. More...
 
class  reader_writer_lock
 A writer-preference queue-based reader-writer lock with local only spinning. The lock grants first in - first out (FIFO) access to writers and starves readers under a continuous load of writers. More...
 
class  runtime_exception
 Exception thrown due to a C++ AMP runtime_exception. This is the base type for all C++ AMP exception types. More...
 
class  scheduler_not_attached
 This class describes an exception thrown when an operation is performed which requires a scheduler to be attached to the current context and one is not. More...
 
struct  scheduler_ptr
 Represents a pointer to a scheduler. This class exists to allow the the specification of a shared lifetime by using shared_ptr or just a plain reference by using raw pointer. More...
 
class  scheduler_resource_allocation_error
 This class describes an exception thrown because of a failure to acquire a critical resource in the Concurrency Runtime. More...
 
class  scheduler_worker_creation_error
 This class describes an exception thrown because of a failure to create a worker execution context in the Concurrency Runtime. More...
 
class  simple_partitioner
 The simple_partitioner class represents a static partitioning of the range iterated over by parallel_for. The partitioner divides the range into chunks such that each chunk has at least the number of iterations specified by the chunk size. More...
 
class  single_assignment
 A single_assignment messaging block is a multi-target, multi-source, ordered propagator_block capable of storing a single, write-once message. More...
 
class  single_link_registry
 The single_link_registry object is a network_link_registry that manages only a single source or target block. More...
 
class  source_block
 The source_block class is an abstract base class for source-only blocks. The class provides basic link management functionality as well as common error checks. More...
 
class  source_link_manager
 The source_link_manager object manages messaging block network links to ISource blocks. More...
 
class  static_partitioner
 The static_partitioner class represents a static partitioning of the range iterated over by parallel_for. The partitioner divides the range into as many chunks as there are workers available to the underyling scheduler. More...
 
class  structured_task_group
 The structured_task_group class represents a highly structured collection of parallel work. You can queue individual parallel tasks to a structured_task_group using task_handle objects, and wait for them to complete, or cancel the task group before they have finished executing, which will abort any tasks that have not begun execution. More...
 
class  target_block
 The target_block class is an abstract base class that provides basic link management functionality and error checking for target only blocks. More...
 
class  task
 The Parallel Patterns Library (PPL) task class. A task object represents work that can be executed asynchronously, and concurrently with other tasks and parallel work produced by parallel algorithms in the Concurrency Runtime. It produces a result of type _ResultType on successful completion. Tasks of type task<void> produce no result. A task can be waited upon and canceled independently of other tasks. It can also be composed with other tasks using continuations(then), and join(when_all) and choice(when_any) patterns. More...
 
class  task< void >
 The Parallel Patterns Library (PPL) task class. A task object represents work that can be executed asynchronously, and concurrently with other tasks and parallel work produced by parallel algorithms in the Concurrency Runtime. It produces a result of type _ResultType on successful completion. Tasks of type task<void> produce no result. A task can be waited upon and canceled independently of other tasks. It can also be composed with other tasks using continuations(then), and join(when_all) and choice(when_any) patterns. More...
 
class  task_canceled
 This class describes an exception thrown by the PPL tasks layer in order to force the current task to cancel. It is also thrown by the get() method on task, for a canceled task. More...
 
class  task_completion_event
 The task_completion_event class allows you to delay the execution of a task until a condition is satisfied, or start a task in response to an external event. More...
 
class  task_completion_event< void >
 The task_completion_event class allows you to delay the execution of a task until a condition is satisfied, or start a task in response to an external event. More...
 
class  task_continuation_context
 The task_continuation_context class allows you to specify where you would like a continuation to be executed. It is only useful to use this class from a Windows Store app. For non-Windows Store apps, the task continuation's execution context is determined by the runtime, and not configurable. More...
 
class  task_group
 The task_group class represents a collection of parallel work which can be waited on or canceled. More...
 
class  task_handle
 The task_handle class represents an individual parallel work item. It encapsulates the instructions and the data required to execute a piece of work. More...
 
class  task_options
 Represents the allowed options for creating a task More...
 
class  tile_barrier
 The tile_barrier class is a capability class that is only creatable by the system, and passed to a tiled parallel_for_each lambda as part of the tiled_index parameter. It provides wait methods whose purpose is to synchronize execution of threads running within the thread group (tile). More...
 
class  tiled_extent
 A tiled_extent is an extent of 1 to 3 dimensions which also subdivides the extent space into 1-, 2-, or 3-dimensional tiles. It has three specialized forms: tiled_extent<_Dim0>, tiled_extent<_Dim0,_Dim1>, and tiled_extent<_Dim0,_Dim1,_Dim2>, where _Dim0-2 specify the length of the tile along each dimension, with _Dim0 being the most-significant dimension and _Dim2 being the least-significant. More...
 
class  tiled_extent< _Dim0, 0, 0 >
 
class  tiled_extent< _Dim0, _Dim1, 0 >
 
class  tiled_index
 A tiled_index is a set of indices of 1 to 3 dimensions which have been subdivided into 1-, 2-, or 3-dimensional tiles in a tiled_extent. It has three specialized forms: tiled_index<_Dim0>, tiled_index<_Dim0, _Dim1>, and tiled_index<_Dim0, _Dim1, _Dim2>, where _Dim0-2 specify the length of the tile along the each dimension, with _Dim0 being the most-significant dimension and _Dim2 being the least-significant. More...
 
class  tiled_index< _Dim0, 0, 0 >
 
class  tiled_index< _Dim0, _Dim1, 0 >
 
class  timer
 A timer messaging block is a single-target source_block capable of sending a message to its target after a specified time period has elapsed or at specific intervals. More...
 
class  transformer
 A transformer messaging block is a single-target, multi-source, ordered propagator_block which can accept messages of one type and is capable of storing an unbounded number of messages of a different type. More...
 
class  unbounded_buffer
 An unbounded_buffer messaging block is a multi-target, multi-source, ordered propagator_block capable of storing an unbounded number of messages. More...
 
class  unsupported_feature
 Exception thrown when an unsupported feature is used More...
 
class  unsupported_os
 This class describes an exception thrown when an unsupported operating system is used. More...
 

Typedefs

typedef __int32 runtime_object_identity
 Each message instance has an identity that follows it as it is cloned and passed between messaging components. This cannot be the address of the message object. More...
 
typedef ::Concurrency::details::_NonReentrantPPLLock::_Scoped_lock _NR_lock
 A lock holder that acquires a non-reentrant lock on instantiation and releases it on destruction. More...
 
typedef ::Concurrency::details::_ReentrantPPLLock::_Scoped_lock _R_lock
 A lock holder that acquires a reentrant lock on instantiation and releases it on destruction More...
 
typedef details::_Reference_counted_obj_ptr< details::_Accelerator_view_impl > _Accelerator_view_impl_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Accelerator_impl > _Accelerator_impl_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Buffer_Buffer_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Texture_Texture_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Sampler_Sampler_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Ubiquitous_buffer_Ubiquitous_buffer_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_Event_impl > _Event_impl_ptr
 
typedef details::_Reference_counted_obj_ptr< details::_View_shape_View_shape_ptr
 
typedef void(__cdecl * TaskProc) (void *)
 Concurrency::details contains definitions of support routines in the public namespaces and one or more macros. Users should not directly interact with this internal namespace. More...
 
typedef void(__cdecl * TaskProc_t) (void *)
 An elementary abstraction for a task, defined as void (__cdecl * TaskProc_t)(void *). A TaskProc is called to invoke the body of a task. More...
 
typedef task_group_status task_status
 A type that represents the terminal state of a task. Valid values are completed and canceled. More...
 

Enumerations

enum  message_status { accepted, declined, postponed, missed }
 The valid responses for an offer of a message object to a block. More...
 
enum  join_type { greedy = 0, non_greedy = 1 }
 The type of a join messaging block. More...
 
enum  agent_status {
  agent_created, agent_runnable, agent_started, agent_done,
  agent_canceled
}
 The valid states for an agent. More...
 
enum  access_type {
  access_type_none = 0, access_type_read = (1 << 0), access_type_write = (1 << 1), access_type_read_write = access_type_read | access_type_write,
  access_type_auto = (1 << 31)
}
 Enumeration type used to denote the various types of access to data. More...
 
enum  queuing_mode { queuing_mode_immediate, queuing_mode_automatic }
 Queuing modes supported for accelerator views More...
 
enum  ConcRT_EventType {
  CONCRT_EVENT_GENERIC = 0, CONCRT_EVENT_START = 1, CONCRT_EVENT_END = 2, CONCRT_EVENT_BLOCK = 3,
  CONCRT_EVENT_UNBLOCK = 4, CONCRT_EVENT_YIELD = 5, CONCRT_EVENT_IDLE = 6, CONCRT_EVENT_ATTACH = 7,
  CONCRT_EVENT_DETACH = 8
}
 The types of events that can be traced using the tracing functionality offered by the Concurrency Runtime. More...
 
enum  Concrt_TraceFlags {
  SchedulerEventFlag = 0x1, ContextEventFlag = 0x2, VirtualProcessorEventFlag = 0x4, ResourceManagerEventFlag = 0x8,
  PPLEventFlag = 0x10, AgentEventFlag = 0x20, AllEventsFlag = 0xFFFFFFFF
}
 Trace flags for the event types More...
 
enum  Agents_EventType {
  AGENTS_EVENT_CREATE = 0, AGENTS_EVENT_START = 1, AGENTS_EVENT_END = 2, AGENTS_EVENT_DESTROY = 3,
  AGENTS_EVENT_SCHEDULE = 4, AGENTS_EVENT_LINK = 5, AGENTS_EVENT_UNLINK = 6, AGENTS_EVENT_NAME = 7
}
 The types of events that can be traced using the tracing functionality offered by the Agents Library More...
 
enum  task_group_status { not_complete, completed, canceled }
 Describes the execution status of a task_group or structured_task_group object. A value of this type is returned by numerous methods that wait on tasks scheduled to a task group to complete. More...
 

Functions

template<class _Type >
_Type _Receive_impl (ISource< _Type > *_Src, unsigned int _Timeout, typename ITarget< _Type >::filter_method const *_Filter_proc)
 A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. If the specified timeout is not COOPERATIVE_TIMEOUT_INFINITE, an exception (operation_timed_out) will be thrown if the specified amount of time expires before a message is received. Note that zero length timeouts should likely use try_receive as opposed to receive with a timeout of zero as it is more efficient and does not throw exceptions on timeouts. More...
 
template<class _Type >
_Type receive (_Inout_ ISource< _Type > *_Src, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
 A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. More...
 
template<class _Type >
_Type receive (_Inout_ ISource< _Type > *_Src, typename ITarget< _Type >::filter_method const &_Filter_proc, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
 A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. More...
 
template<class _Type >
_Type receive (ISource< _Type > &_Src, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
 A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. More...
 
template<class _Type >
_Type receive (ISource< _Type > &_Src, typename ITarget< _Type >::filter_method const &_Filter_proc, unsigned int _Timeout=COOPERATIVE_TIMEOUT_INFINITE)
 A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. More...
 
template<class _Type >
bool _Try_receive_impl (ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const *_Filter_proc)
 Helper function that implements try_receive A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, try_receive will return false. More...
 
template<class _Type >
bool try_receive (_Inout_ ISource< _Type > *_Src, _Type &_value)
 A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false. More...
 
template<class _Type >
bool try_receive (_Inout_ ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const &_Filter_proc)
 A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false. More...
 
template<class _Type >
bool try_receive (ISource< _Type > &_Src, _Type &_value)
 A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false. More...
 
template<class _Type >
bool try_receive (ISource< _Type > &_Src, _Type &_value, typename ITarget< _Type >::filter_method const &_Filter_proc)
 A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false. More...
 
template<class _Type >
bool send (_Inout_ ITarget< _Type > *_Trg, const _Type &_Data)
 A synchronous send operation, which waits until the target either accepts or declines the message. More...
 
template<class _Type >
bool send (ITarget< _Type > &_Trg, const _Type &_Data)
 A synchronous send operation, which waits until the target either accepts or declines the message. More...
 
template<class _Type >
bool asend (_Inout_ ITarget< _Type > *_Trg, const _Type &_Data)
 An asynchronous send operation, which schedules a task to propagate the data to the target block. More...
 
template<class _Type >
bool asend (ITarget< _Type > &_Trg, const _Type &_Data)
 An asynchronous send operation, which schedules a task to propagate the value to the target block. More...
 
template<typename _Type1 , typename _Type2 , typename... _Types>
choice< std::tuple< _Type1, _Type2, _Types...> > make_choice (_Type1 _Item1, _Type2 _Item2, _Types..._Items)
 Constructs a choice messaging block from an optional Scheduler or ScheduleGroup and two or more input sources. More...
 
template<typename _Type1 , typename _Type2 , typename... _Types>
multitype_join< std::tuple< _Type1, _Type2, _Types...> > make_join (_Type1 _Item1, _Type2 _Item2, _Types..._Items)
 Constructs a non_greedy multitype_join messaging block from an optional Scheduler or ScheduleGroup and two or more input sources. More...
 
template<typename _Type1 , typename _Type2 , typename... _Types>
multitype_join< std::tuple< _Type1, _Type2, _Types...>, greedymake_greedy_join (_Type1 _Item1, _Type2 _Item2, _Types..._Items)
 Constructs a greedy multitype_join messaging block from an optional Scheduler or ScheduleGroup and two or more input sources. More...
 
template<class _Type >
void Trace_agents_register_name (_Inout_ _Type *_PObject, _In_z_ const wchar_t *_Name)
 Associates the given name to the message block or agent in the ETW trace. More...
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, bool >::type operator== (const _Tuple_type< _Rank > &_Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, bool >::type operator!= (const _Tuple_type< _Rank > &_Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator+ (const _Tuple_type< _Rank > &_Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator- (const _Tuple_type< _Rank > &_Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator+ (const _Tuple_type< _Rank > &_Lhs, typename _Tuple_type< _Rank >::value_type _Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator+ (typename _Tuple_type< _Rank >::value_type _Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator- (const _Tuple_type< _Rank > &_Lhs, typename _Tuple_type< _Rank >::value_type _Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator- (typename _Tuple_type< _Rank >::value_type _Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator* (const _Tuple_type< _Rank > &_Lhs, typename _Tuple_type< _Rank >::value_type _Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator* (typename _Tuple_type< _Rank >::value_type _Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator/ (const _Tuple_type< _Rank > &_Lhs, typename _Tuple_type< _Rank >::value_type _Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator/ (typename _Tuple_type< _Rank >::value_type _Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator% (const _Tuple_type< _Rank > &_Lhs, typename _Tuple_type< _Rank >::value_type _Rhs) __GPU
 
template<int _Rank, template< int > class _Tuple_type>
std::enable_if< details::_Is_extent_or_index< _Tuple_type< _Rank > >::value, _Tuple_type< _Rank > >::type operator% (typename _Tuple_type< _Rank >::value_type _Lhs, const _Tuple_type< _Rank > &_Rhs) __GPU
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array< _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array into the destination array. More...
 
template<typename _Value_type , int _Rank>
void copy (const array< _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array into the destination array. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (InputIterator _SrcFirst, InputIterator _SrcLast, array< _Value_type, _Rank > &_Dest)
 Asynchronously copies the elements in the range [_SrcFirst, _SrcLast) into the destination array. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
void copy (InputIterator _SrcFirst, InputIterator _SrcLast, array< _Value_type, _Rank > &_Dest)
 Copies the elements in the range [_SrcFirst, _SrcLast) into the destination array. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (InputIterator _SrcFirst, array< _Value_type, _Rank > &_Dest)
 Asynchronously copies the elements beginning at _SrcFirst into the destination array. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
void copy (InputIterator _SrcFirst, array< _Value_type, _Rank > &_Dest)
 Copies the elements beginning at _SrcFirst into the destination array. More...
 
template<typename OutputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
 Asynchronously copies the contents of the array into the destination beginning at _DestIter. More...
 
template<typename OutputIterator , typename _Value_type , int _Rank>
void copy (const array< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
 Copies the contents of the array into the destination beginning at _DestIter. More...
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array< _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array into the destination array_view. More...
 
template<typename _Value_type , int _Rank>
void copy (const array< _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array into the destination array_view. More...
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array_view< const _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array_view into the destination array. More...
 
template<typename _Value_type , int _Rank>
void copy (const array_view< const _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array_view into the destination array. More...
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array_view< _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array_view into the destination array. More...
 
template<typename _Value_type , int _Rank>
void copy (const array_view< _Value_type, _Rank > &_Src, array< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array_view into the destination array. More...
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array_view< const _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array_view into the destination array_view. More...
 
template<typename _Value_type , int _Rank>
void copy (const array_view< const _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array_view into the destination array_view. More...
 
template<typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array_view< _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Asynchronously copies the contents of the source array_view into the destination array_view. More...
 
template<typename _Value_type , int _Rank>
void copy (const array_view< _Value_type, _Rank > &_Src, const array_view< _Value_type, _Rank > &_Dest)
 Copies the contents of the source array_view into the destination array_view. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (InputIterator _SrcFirst, InputIterator _SrcLast, const array_view< _Value_type, _Rank > &_Dest)
 Asynchronously copies the elements in the range [_SrcFirst, _SrcLast) into the destination array_view. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (InputIterator _SrcFirst, const array_view< _Value_type, _Rank > &_Dest)
 Asynchronously copies the elements beginning at _SrcFirst into the destination array_view. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
void copy (InputIterator _SrcFirst, InputIterator _SrcLast, const array_view< _Value_type, _Rank > &_Dest)
 Copies the elements in the range [_SrcFirst, _SrcLast) into the destination array_view. More...
 
template<typename InputIterator , typename _Value_type , int _Rank>
void copy (InputIterator _SrcFirst, const array_view< _Value_type, _Rank > &_Dest)
 Copies the contents of an STL container into the destination array_view. More...
 
template<typename OutputIterator , typename _Value_type , int _Rank>
concurrency::completion_future copy_async (const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
 Asynchronously copies the contents of the array_view into the destination beginning at _DestIter. More...
 
template<typename OutputIterator , typename _Value_type , int _Rank>
void copy (const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
 Copies the contents of the array_view into the destination beginning at _DestIter. More...
 
int atomic_fetch_add (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Performs an atomic addition of _Value to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_add (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Performs an atomic addition of _Value to the memory location pointed to by _Dest More...
 
int atomic_fetch_sub (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Performs an atomic subtraction of _Value from the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_sub (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Performs an atomic subtraction of _Value from the memory location pointed to by _Dest More...
 
int atomic_fetch_inc (_Inout_ int *_Dest) __GPU_ONLY
 Performs an atomic increment to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_inc (_Inout_ unsigned int *_Dest) __GPU_ONLY
 Performs an atomic increment to the memory location pointed to by _Dest More...
 
int atomic_fetch_dec (_Inout_ int *_Dest) __GPU_ONLY
 Performs an atomic decrement to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_dec (_Inout_ unsigned int *_Dest) __GPU_ONLY
 Performs an atomic decrement to the memory location pointed to by _Dest More...
 
int atomic_exchange (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Sets the value of location pointed to by _Dest to _Value as an atomic operation More...
 
unsigned int atomic_exchange (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Sets the value of location pointed to by _Dest to _Value as an atomic operation More...
 
float atomic_exchange (_Inout_ float *_Dest, float _Value) __GPU_ONLY
 Sets the value of location pointed to by _Dest to _Value as an atomic operation More...
 
bool atomic_compare_exchange (_Inout_ int *_Dest, _Inout_ int *_Expected_value, int _Value) __GPU_ONLY
 Atomically, compares the value pointed to by _Dest for equality with that pointed to by _Expected_value, and if true, returns true and replaces the value with _Value, and if false, returns false and updates the value pointed to by _Expected_value with the value pointed to by _Dest More...
 
bool atomic_compare_exchange (_Inout_ unsigned int *_Dest, _Inout_ unsigned int *_Expected_value, unsigned int _Value) __GPU_ONLY
 Atomically, compares the value pointed to by _Dest for equality with that pointed to by _Expected_value, and if true, returns true and replaces the value with _Value, and if false, returns false and updates the value pointed to by _Expected_value with the value pointed to by _Dest More...
 
int atomic_fetch_max (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Atomically computes the maximum of _Value and the value of the memory location pointed to by _Dest, and stores the maximum value to the memory location More...
 
unsigned int atomic_fetch_max (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Atomically computes the maximum of _Value and the value of the memory location pointed to by _Dest, and stores the maximum value to the memory location More...
 
int atomic_fetch_min (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Atomically computes the minimum of _Value and the value of the memory location pointed to by _Dest, and stores the minimum value to the memory location More...
 
unsigned int atomic_fetch_min (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Atomically computes the minimum of _Value and the value of the memory location pointed to by _Dest, and stores the minimum value to the memory location More...
 
int atomic_fetch_and (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Performs an atomic bitwise and operation of _Value to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_and (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Performs an atomic bitwise and operation of _Value to the memory location pointed to by _Dest More...
 
int atomic_fetch_or (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Performs an atomic bitwise or operation of _Value to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_or (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Performs an atomic bitwise or operation of _Value to the memory location pointed to by _Dest More...
 
int atomic_fetch_xor (_Inout_ int *_Dest, int _Value) __GPU_ONLY
 Performs an atomic bitwise xor operation of _Value to the memory location pointed to by _Dest More...
 
unsigned int atomic_fetch_xor (_Inout_ unsigned int *_Dest, unsigned int _Value) __GPU_ONLY
 Performs an atomic bitwise xor operation of _Value to the memory location pointed to by _Dest More...
 
template<int _Rank, typename _Kernel_type >
void parallel_for_each (const extent< _Rank > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain on an accelerator_view. The accelerator_view is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator_view can be derived, the default is chosen. More...
 
template<int _Dim0, int _Dim1, int _Dim2, typename _Kernel_type >
void parallel_for_each (const tiled_extent< _Dim0, _Dim1, _Dim2 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 3-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen. More...
 
template<int _Dim0, int _Dim1, typename _Kernel_type >
void parallel_for_each (const tiled_extent< _Dim0, _Dim1 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 2-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen. More...
 
template<int _Dim0, typename _Kernel_type >
void parallel_for_each (const tiled_extent< _Dim0 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 1-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen. More...
 
template<int _Rank, typename _Kernel_type >
void parallel_for_each (const accelerator_view &_Accl_view, const extent< _Rank > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain on an accelerator. More...
 
template<int _Dim0, int _Dim1, int _Dim2, typename _Kernel_type >
void parallel_for_each (const accelerator_view &_Accl_view, const tiled_extent< _Dim0, _Dim1, _Dim2 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 3-dimensional regions. More...
 
template<int _Dim0, int _Dim1, typename _Kernel_type >
void parallel_for_each (const accelerator_view &_Accl_view, const tiled_extent< _Dim0, _Dim1 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 2-dimensional regions. More...
 
template<int _Dim0, typename _Kernel_type >
void parallel_for_each (const accelerator_view &_Accl_view, const tiled_extent< _Dim0 > &_Compute_domain, const _Kernel_type &_Kernel)
 Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 1-dimensional regions. More...
 
void direct3d_abort () __GPU_ONLY
 
void direct3d_errorf (const char *,...) __GPU_ONLY
 
void direct3d_printf (const char *,...) __GPU_ONLY
 
void all_memory_fence (const tile_barrier &_Barrier) __GPU_ONLY
 Memory fences and tile barriers. More...
 
void global_memory_fence (const tile_barrier &_Barrier) __GPU_ONLY
 Ensures that global memory accesses are visible to other threads in the thread tile, and are executed according to program order More...
 
void tile_static_memory_fence (const tile_barrier &_Barrier) __GPU_ONLY
 Ensures that tile_static memory accesses are visible to other threads in the thread tile, and are executed according to program order More...
 
_AMPIMP void __cdecl amp_uninitialize ()
 Uninitializes the C++ AMP runtime. It is legal to call this function multiple times during an applications lifetime. Calling any C++ AMP API afer calling this function will reinitialize the C++ AMP runtime. Note that it is illegal to use C++ AMP objects across calls to this function and doing so will result in undefined behavior. Also, concurrently calling this function and any other AMP APIs is illegal and would result in undefined behavior. More...
 
_CONCRTIMP void __cdecl wait (unsigned int _Milliseconds)
 Pauses the current context for a specified amount of time. More...
 
_CONCRTIMP void *__cdecl Alloc (size_t _NumBytes)
 Allocates a block of memory of the size specified from the Concurrency Runtime Caching Suballocator. More...
 
_CONCRTIMP void __cdecl Free (_Pre_maybenull_ _Post_invalid_ void *_PAllocation)
 Releases a block of memory previously allocated by the Alloc method to the Concurrency Runtime Caching Suballocator. More...
 
 __declspec (deprecated("Concurrency::EnableTracing is a deprecated function.")) _CONCRTIMP HRESULT __cdecl EnableTracing()
 Enables tracing in the Concurrency Runtime. This function is deprecated because ETW tracing is now on by default. More...
 
 __declspec (deprecated("Concurrency::DisableTracing is a deprecated function.")) _CONCRTIMP HRESULT __cdecl DisableTracing()
 Disables tracing in the Concurrency Runtime. This function is deprecated because ETW tracing is unregistered by default. More...
 
_CONCRTIMP void __cdecl _Trace_ppl_function (const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
 
_CONCRTIMP void __cdecl _Trace_agents (Agents_EventType _Type, __int64 _AgentId,...)
 
template<typename _Ty , class A1 , class A2 >
bool operator== (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is equal to the concurrent_vector object on the right side. More...
 
template<typename _Ty , class A1 , class A2 >
bool operator!= (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is not equal to the concurrent_vector object on the right side. More...
 
template<typename _Ty , class A1 , class A2 >
bool operator< (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is less than the concurrent_vector object on the right side. More...
 
template<typename _Ty , class A1 , class A2 >
bool operator> (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is greater than the concurrent_vector object on the right side. More...
 
template<typename _Ty , class A1 , class A2 >
bool operator<= (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is less than or equal to the concurrent_vector object on the right side. More...
 
template<typename _Ty , class A1 , class A2 >
bool operator>= (const concurrent_vector< _Ty, A1 > &_A, const concurrent_vector< _Ty, A2 > &_B)
 Tests if the concurrent_vector object on the left side of the operator is greater than or equal to the concurrent_vector object on the right side. More...
 
template<typename _Ty , class _Ax >
void swap (concurrent_vector< _Ty, _Ax > &_A, concurrent_vector< _Ty, _Ax > &_B)
 Exchanges the elements of two concurrent_vector objects. More...
 
template<class _Function >
task_handle< _Function > make_task (const _Function &_Func)
 A factory method for creating a task_handle object. More...
 
template<typename _Function >
void run_with_cancellation_token (const _Function &_Func, cancellation_token _Ct)
 Executes a function object immediately and synchronously in the context of a given cancellation token. More...
 
void interruption_point ()
 Creates an interruption point for cancellation. If a cancellation is in progress in the context where this function is called, this will throw an internal exception that aborts the execution of the currently executing parallel work. If cancellation is not in progress, the function does nothing. More...
 
_CONCRTIMP bool __cdecl is_current_task_group_canceling ()
 Returns an indication of whether the task group which is currently executing inline on the current context is in the midst of an active cancellation (or will be shortly). Note that if there is no task group currently executing inline on the current context, false will be returned. More...
 
template<typename _Function1 , typename _Function2 >
void _Parallel_invoke_impl (const _Function1 &_Func1, const _Function2 &_Func2)
 
template<typename _Function1 , typename _Function2 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5, const _Function6 &_Func6)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5, const _Function6 &_Func6, const _Function7 &_Func7)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5, const _Function6 &_Func6, const _Function7 &_Func7, const _Function8 &_Func8)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 , typename _Function9 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5, const _Function6 &_Func6, const _Function7 &_Func7, const _Function8 &_Func8, const _Function9 &_Func9)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 , typename _Function9 , typename _Function10 >
void parallel_invoke (const _Function1 &_Func1, const _Function2 &_Func2, const _Function3 &_Func3, const _Function4 &_Func4, const _Function5 &_Func5, const _Function6 &_Func6, const _Function7 &_Func7, const _Function8 &_Func8, const _Function9 &_Func9, const _Function10 &_Func10)
 Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()(). More...
 
template<typename _Worker_class , typename _Index_type , typename Partitioner >
void _Parallel_chunk_task_group_run (structured_task_group &_Task_group, task_handle< _Worker_class > *_Chunk_helpers, const Partitioner &, _Index_type _I)
 
template<typename _Worker_class , typename _Index_type >
void _Parallel_chunk_task_group_run (structured_task_group &_Task_group, task_handle< _Worker_class > *_Chunk_helpers, affinity_partitioner &_Part, _Index_type _I)
 
template<typename _Worker_class , typename _Random_iterator , typename _Index_type , typename _Function , typename _Partitioner >
void _Parallel_chunk_impl (const _Random_iterator &_First, _Index_type _Range_arg, const _Index_type &_Step, const _Function &_Func, _Partitioner &&_Part)
 
template<typename _Worker_class , typename _Random_iterator , typename _Index_type , typename _Function >
void _Parallel_chunk_impl (const _Random_iterator &_First, _Index_type _Range_arg, const _Index_type &_Step, const _Function &_Func)
 
template<typename _Index_type , typename _Diff_type , typename _Function >
void _Parallel_for_partitioned_impl (_Index_type _First, _Diff_type _Range_arg, _Diff_type _Step, const _Function &_Func, const auto_partitioner &_Part)
 
template<typename _Index_type , typename _Diff_type , typename _Function >
void _Parallel_for_partitioned_impl (_Index_type _First, _Diff_type _Range_arg, _Diff_type _Step, const _Function &_Func, const static_partitioner &_Part)
 
template<typename _Index_type , typename _Diff_type , typename _Function >
void _Parallel_for_partitioned_impl (_Index_type _First, _Diff_type _Range_arg, _Diff_type _Step, const _Function &_Func, const simple_partitioner &_Part)
 
template<typename _Index_type , typename _Diff_type , typename _Function >
void _Parallel_for_partitioned_impl (_Index_type _First, _Diff_type _Range_arg, _Diff_type _Step, const _Function &_Func, affinity_partitioner &_Part)
 
template<typename _Index_type , typename _Function , typename _Partitioner >
void _Parallel_for_impl (_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func, _Partitioner &&_Part)
 
template<typename _Index_type , typename _Function >
void _Parallel_for_impl (_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func)
 
template<typename _Index_type , typename _Function , typename _Partitioner >
void parallel_for (_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func, _Partitioner &&_Part)
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Index_type , typename _Function >
void parallel_for (_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func)
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Index_type , typename _Function >
void parallel_for (_Index_type _First, _Index_type _Last, const _Function &_Func, const auto_partitioner &_Part=auto_partitioner())
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Index_type , typename _Function >
void parallel_for (_Index_type _First, _Index_type _Last, const _Function &_Func, const static_partitioner &_Part)
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Index_type , typename _Function >
void parallel_for (_Index_type _First, _Index_type _Last, const _Function &_Func, const simple_partitioner &_Part)
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Index_type , typename _Function >
void parallel_for (_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
 parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel. More...
 
template<typename _Forward_iterator , typename _Function >
void _Parallel_for_each_chunk (_Forward_iterator &_First, const _Forward_iterator &_Last, const _Function &_Func, task_group &_Task_group)
 
template<typename _Forward_iterator , typename _Function >
void _Parallel_for_each_forward_impl (_Forward_iterator &_First, const _Forward_iterator &_Last, const _Function &_Func, task_group &_Task_group)
 
template<typename _Forward_iterator , typename _Function >
void _Parallel_for_each_impl (_Forward_iterator _First, const _Forward_iterator &_Last, const _Function &_Func, const auto_partitioner &, std::forward_iterator_tag)
 
template<typename _Random_iterator , typename _Index_type , typename _Function >
void _Parallel_for_each_partitioned_impl (const _Random_iterator &_First, _Index_type _Range_arg, _Index_type _Step, const _Function &_Func, const auto_partitioner &_Part)
 
template<typename _Random_iterator , typename _Index_type , typename _Function >
void _Parallel_for_each_partitioned_impl (const _Random_iterator &_First, _Index_type _Range_arg, _Index_type _Step, const _Function &_Func, const static_partitioner &_Part)
 
template<typename _Random_iterator , typename _Index_type , typename _Function >
void _Parallel_for_each_partitioned_impl (const _Random_iterator &_First, _Index_type _Range_arg, _Index_type _Step, const _Function &_Func, const simple_partitioner &_Part)
 
template<typename _Random_iterator , typename _Index_type , typename _Function >
void _Parallel_for_each_partitioned_impl (const _Random_iterator &_First, _Index_type _Range_arg, _Index_type _Step, const _Function &_Func, affinity_partitioner &_Part)
 
template<typename _Random_iterator , typename _Function , typename _Partitioner >
void _Parallel_for_each_impl (const _Random_iterator &_First, const _Random_iterator &_Last, const _Function &_Func, _Partitioner &&_Part, std::random_access_iterator_tag)
 
template<typename _Iterator , typename _Function >
void parallel_for_each (_Iterator _First, _Iterator _Last, const _Function &_Func)
 parallel_for_each applies a specified function to each element within a range, in parallel. It is semantically equivalent to the for_each function in the std namespace, except that iteration over the elements is performed in parallel, and the order of iteration is unspecified. The argument _Func must support a function call operator of the form operator()(T) where the parameter T is the item type of the container being iterated over. More...
 
template<typename _Iterator , typename _Function , typename _Partitioner >
void parallel_for_each (_Iterator _First, _Iterator _Last, const _Function &_Func, _Partitioner &&_Part)
 parallel_for_each applies a specified function to each element within a range, in parallel. It is semantically equivalent to the for_each function in the std namespace, except that iteration over the elements is performed in parallel, and the order of iteration is unspecified. The argument _Func must support a function call operator of the form operator()(T) where the parameter T is the item type of the container being iterated over. More...
 
template<typename _Reduce_type , typename _Forward_iterator , typename _Range_reduce_fun , typename _Sym_reduce_fun >
_Reduce_type parallel_reduce (_Forward_iterator _Begin, _Forward_iterator _End, const _Reduce_type &_Identity, const _Range_reduce_fun &_Range_fun, const _Sym_reduce_fun &_Sym_fun)
 Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value. More...
 
template<typename _Forward_iterator , typename _Sym_reduce_fun >
std::iterator_traits< _Forward_iterator >::value_type parallel_reduce (_Forward_iterator _Begin, _Forward_iterator _End, const typename std::iterator_traits< _Forward_iterator >::value_type &_Identity, _Sym_reduce_fun _Sym_fun)
 Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value. More...
 
template<typename _Forward_iterator >
std::iterator_traits< _Forward_iterator >::value_type parallel_reduce (_Forward_iterator _Begin, _Forward_iterator _End, const typename std::iterator_traits< _Forward_iterator >::value_type &_Identity)
 Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value. More...
 
template<typename _Forward_iterator , typename _Function >
_Function::_Reduce_type _Parallel_reduce_impl (_Forward_iterator _First, const _Forward_iterator &_Last, const _Function &_Func, std::forward_iterator_tag)
 
template<typename _Worker , typename _Random_iterator , typename _Function >
void _Parallel_reduce_random_executor (_Random_iterator _Begin, _Random_iterator _End, const _Function &_Fun)
 
template<typename _Random_iterator , typename _Function >
_Function::_Reduce_type _Parallel_reduce_impl (_Random_iterator _First, _Random_iterator _Last, const _Function &_Func, std::random_access_iterator_tag)
 
template<typename _Forward_iterator , typename _Function >
void _Parallel_reduce_forward_executor (_Forward_iterator _First, _Forward_iterator _Last, const _Function &_Func, task_group &_Task_group)
 
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator >
void _Parallel_transform_binary_impl2 (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Input_iterator2 _First2, _Output_iterator &_Result, const _Binary_operator&_Binary_op, task_group &_Tg)
 
template<typename _Input_iterator , typename _Output_iterator , typename _Unary_operator >
void _Parallel_transform_unary_impl2 (_Input_iterator _First, _Input_iterator _Last, _Output_iterator &_Result, const _Unary_operator&_Unary_op, task_group &_Tg)
 
template<typename _Input_iterator , typename _Output_iterator , typename _Unary_operator , typename _Partitioner >
_Output_iterator _Parallel_transform_unary_impl (_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
 
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Output_iterator _Result, const _Unary_operator&_Unary_op, const auto_partitioner &_Part=auto_partitioner())
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Output_iterator _Result, const _Unary_operator&_Unary_op, const static_partitioner &_Part)
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Output_iterator _Result, const _Unary_operator&_Unary_op, const simple_partitioner &_Part)
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Output_iterator _Result, const _Unary_operator&_Unary_op, affinity_partitioner &_Part)
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator , typename _Partitioner >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Input_iterator2 _First2, _Output_iterator _Result, const _Binary_operator&_Binary_op, _Partitioner &&_Part)
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator >
_Output_iterator parallel_transform (_Input_iterator1 _First1, _Input_iterator1 _Last1, _Input_iterator2 _First2, _Output_iterator _Result, const _Binary_operator&_Binary_op)
 Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform. More...
 
template<typename _Random_iterator , typename _Function >
size_t _Median_of_three (const _Random_iterator &_Begin, size_t _A, size_t _B, size_t _C, const _Function &_Func, bool &_Potentially_equal)
 
template<typename _Random_iterator , typename _Function >
size_t _Median_of_nine (const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, bool &_Potentially_equal)
 
template<typename _Random_iterator , typename _Function >
size_t _Select_median_pivot (const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, const size_t _Chunk_size, bool &_Potentially_equal)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
size_t _Search_mid_point (const _Random_iterator &_Begin1, size_t &_Len1, const _Random_buffer_iterator &_Begin2, size_t &_Len2, const _Function &_Func)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Random_output_iterator , typename _Function >
void _Merge_chunks (_Random_iterator _Begin1, const _Random_iterator &_End1, _Random_buffer_iterator _Begin2, const _Random_buffer_iterator &_End2, _Random_output_iterator _Output, const _Function &_Func)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Random_output_iterator , typename _Function >
void _Parallel_merge (_Random_iterator _Begin1, size_t _Len1, _Random_buffer_iterator _Begin2, size_t _Len2, _Random_output_iterator _Output, const _Function &_Func, size_t _Div_num)
 
template<typename _Ty , typename _Function >
size_t _Radix_key (const _Ty &_Val, size_t _Radix, _Function _Proj_func)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void _Integer_radix_pass (const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void _Integer_radix_sort (const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func, size_t _Deep=0)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void _Parallel_integer_radix_sort (const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func, const size_t _Chunk_size, size_t _Deep=0)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void _Parallel_integer_sort_asc (const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, _Function _Proj_func, const size_t _Chunk_size)
 
template<typename _Random_iterator , typename _Function >
void _Parallel_quicksort_impl (const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, size_t _Div_num, const size_t _Chunk_size, int _Depth)
 
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
bool _Parallel_buffered_sort_impl (const _Random_iterator &_Begin, size_t _Size, _Random_buffer_iterator _Output, const _Function &_Func, int _Div_num, const size_t _Chunk_size)
 
template<typename _Allocator >
_Allocator::pointer _Construct_buffer (size_t _N, _Allocator &_Alloc)
 
template<typename _Allocator >
void _Destroy_buffer (typename _Allocator::pointer _P, size_t _N, _Allocator &_Alloc)
 
template<typename _Random_iterator , typename _Function >
void parallel_sort (const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Func, const size_t _Chunk_size=2048)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort. More...
 
template<typename _Random_iterator >
void parallel_sort (const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort. More...
 
template<typename _Allocator , typename _Random_iterator , typename _Function >
void parallel_buffered_sort (const _Allocator &_Alloc, const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Func, const size_t _Chunk_size=2048)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator , typename _Function >
void parallel_buffered_sort (const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Func, const size_t _Chunk_size=2048)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Random_iterator , typename _Function >
void parallel_buffered_sort (const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Func, const size_t _Chunk_size=2048)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Random_iterator >
void parallel_buffered_sort (const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator >
void parallel_buffered_sort (const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator >
void parallel_buffered_sort (const _Allocator &_Alloc, const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted. More...
 
template<typename _Random_iterator >
void parallel_radixsort (const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator >
void parallel_radixsort (const _Allocator &_Alloc, const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator >
void parallel_radixsort (const _Random_iterator &_Begin, const _Random_iterator &_End)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator , typename _Function >
void parallel_radixsort (const _Allocator &_Alloc, const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Proj_func, const size_t _Chunk_size=256 *256)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
template<typename _Allocator , typename _Random_iterator , typename _Function >
void parallel_radixsort (const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Proj_func, const size_t _Chunk_size=256 *256)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
template<typename _Random_iterator , typename _Function >
void parallel_radixsort (const _Random_iterator &_Begin, const _Random_iterator &_End, const _Function &_Proj_func, const size_t _Chunk_size=256 *256)
 Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted. More...
 
template<class _Ty >
bool await_ready (const task< _Ty > &_Task)
 
template<class _Ty , typename _Handle >
void await_suspend (task< _Ty > &_Task, _Handle _ResumeCb)
 
template<class _Ty >
auto await_resume (const task< _Ty > &_Task)
 
struct __declspec (novtable) scheduler_interface
 Scheduler Interface More...
 
 __declspec (noreturn) void __cdecl cancel_current_task()
 Cancels the currently executing task. This function can be called from within the body of a task to abort the task's execution and cause it to enter the canceled state. While it may be used in response to a cancellation request through a cancellation_token, you may also use it by itself, to initiate cancellation of the task that is currently executing. More...
 
template<typename _Ty >
 __declspec (noinline) auto create_task(_Ty _Param
 Creates a PPL task object. create_task can be used anywhere you would have used a task constructor. It is provided mainly for convenience, because it allows use of the auto keyword while creating tasks. More...
 
const ::std::shared_ptr< scheduler_interface > & get_ambient_scheduler ()
 
void set_ambient_scheduler (const ::std::shared_ptr< scheduler_interface > &_Scheduler)
 

Variables

const size_t COOPERATIVE_WAIT_TIMEOUT = SIZE_MAX
 Value indicating that a wait timed out. More...
 
const unsigned int COOPERATIVE_TIMEOUT_INFINITE = (unsigned int)-1
 Value indicating that a wait should never time out. More...
 
_CONCRTIMP const GUID ConcRT_ProviderGuid
 The ETW provider GUID for the Concurrency Runtime. More...
 
_CONCRTIMP const GUID ConcRTEventGuid
 A category GUID describing ETW events fired by the Concurrency Runtime that are not more specifically described by another category. More...
 
_CONCRTIMP const GUID SchedulerEventGuid
 A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to scheduler activity. More...
 
_CONCRTIMP const GUID ScheduleGroupEventGuid
 A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to schedule groups. More...
 
_CONCRTIMP const GUID ContextEventGuid
 A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to contexts. More...
 
_CONCRTIMP const GUID ChoreEventGuid
 A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to chores or tasks. More...
 
_CONCRTIMP const GUID VirtualProcessorEventGuid
 A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to virtual processors. More...
 
_CONCRTIMP const GUID LockEventGuid
 A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to locks. More...
 
_CONCRTIMP const GUID ResourceManagerEventGuid
 A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to the resource manager. More...
 
_CONCRTIMP const GUID PPLParallelInvokeEventGuid
 A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to usage of the parallel_invoke function. More...
 
_CONCRTIMP const GUID PPLParallelForEventGuid
 A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to usage of the parallel_for function. More...
 
_CONCRTIMP const GUID PPLParallelForeachEventGuid
 A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to usage of the parallel_for_each function. More...
 
_CONCRTIMP const GUID AgentEventGuid
 A category GUID ({B9B5B78C-0713-4898-A21A-C67949DCED07}) describing ETW events fired by the Agents library in the Concurrency Runtime. More...
 

Detailed Description

The Concurrency namespace provides classes and functions that provide access to the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime.

The concurrency namespace provides classes and functions that give you access to the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime.

The Concurrency namespace provides classes and functions that give you access to the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime.

The Concurrency namespace provides classes and functions that access the Concurrency Runtime, a concurrent programming framework for C++. For more information, see Concurrency Runtime.

Typedef Documentation

A lock holder that acquires a non-reentrant lock on instantiation and releases it on destruction.

A lock holder that acquires a reentrant lock on instantiation and releases it on destruction

Each message instance has an identity that follows it as it is cloned and passed between messaging components. This cannot be the address of the message object.

A type that represents the terminal state of a task. Valid values are completed and canceled.

See also
task Class
typedef void(__cdecl * Concurrency::TaskProc) (void *)

Concurrency::details contains definitions of support routines in the public namespaces and one or more macros. Users should not directly interact with this internal namespace.

An elementary abstraction for a task, defined as void (__cdecl * TaskProc)(void *). A TaskProc is called to invoke the body of a task.

typedef void(__cdecl * Concurrency::TaskProc_t) (void *)

An elementary abstraction for a task, defined as void (__cdecl * TaskProc_t)(void *). A TaskProc is called to invoke the body of a task.

Enumeration Type Documentation

Enumeration type used to denote the various types of access to data.

Enumerator
access_type_none 
access_type_read 
access_type_write 
access_type_read_write 
access_type_auto 
104  {
105  access_type_none = 0,
106  access_type_read = (1 << 0),
107  access_type_write = (1 << 1),
109  access_type_auto = (1 << 31),
110  };
Definition: amprt.h:107
Definition: amprt.h:109
Definition: amprt.h:105
Definition: amprt.h:106

The valid states for an agent.

For more information, see Asynchronous Agents.

Enumerator
agent_created 

The agent has been created but not started.

agent_runnable 

The agent has been started, but not entered its run method.

agent_started 

The agent has started.

agent_done 

The agent finished without being canceled.

agent_canceled 

The agent was canceled.

13237  {
13241 
13242  agent_created,
13246 
13251 
13252  agent_started,
13256 
13257  agent_done,
13261 
13263 };
The agent has been started, but not entered its run method.
Definition: agents.h:13247
The agent finished without being canceled.
Definition: agents.h:13257
The agent has been created but not started.
Definition: agents.h:13242
The agent has started.
Definition: agents.h:13252
The agent was canceled.
Definition: agents.h:13262

The types of events that can be traced using the tracing functionality offered by the Agents Library

Enumerator
AGENTS_EVENT_CREATE 

An event type that represents the creation of an object

AGENTS_EVENT_START 

An event type that represents the initiation of some processing

AGENTS_EVENT_END 

An event type that represents the conclusion of some processing

AGENTS_EVENT_DESTROY 

An event type that represents the deletion of an object

AGENTS_EVENT_SCHEDULE 

An event type that represents the scheduling of a process

AGENTS_EVENT_LINK 

An event type that represents the linking of message blocks

AGENTS_EVENT_UNLINK 

An event type that represents the unlinking of message blocks

AGENTS_EVENT_NAME 

An event type that represents the name for an object

5644 {
5648 
5649  AGENTS_EVENT_CREATE = 0,
5650 
5654 
5655  AGENTS_EVENT_START = 1,
5656 
5660 
5661  AGENTS_EVENT_END = 2,
5662 
5666 
5668 
5672 
5674 
5678 
5679  AGENTS_EVENT_LINK = 5,
5680 
5684 
5685  AGENTS_EVENT_UNLINK = 6,
5686 
5690 
5691  AGENTS_EVENT_NAME = 7
5692 
5693 };
An event type that represents the linking of message blocks
Definition: concrt.h:5679
An event type that represents the unlinking of message blocks
Definition: concrt.h:5685
An event type that represents the creation of an object
Definition: concrt.h:5649
An event type that represents the name for an object
Definition: concrt.h:5691
An event type that represents the conclusion of some processing
Definition: concrt.h:5661
An event type that represents the scheduling of a process
Definition: concrt.h:5673
An event type that represents the initiation of some processing
Definition: concrt.h:5655
An event type that represents the deletion of an object
Definition: concrt.h:5667

The types of events that can be traced using the tracing functionality offered by the Concurrency Runtime.

Enumerator
CONCRT_EVENT_GENERIC 

An event type used for miscellaneous events.

CONCRT_EVENT_START 

An event type that marks the beginning of a start/end event pair.

CONCRT_EVENT_END 

An event type that marks the beginning of a start/end event pair.

CONCRT_EVENT_BLOCK 

An event type that represents the act of a context blocking.

CONCRT_EVENT_UNBLOCK 

An event type that represents the act of unblocking a context.

CONCRT_EVENT_YIELD 

An event type that represents the act of a context yielding.

CONCRT_EVENT_IDLE 

An event type that represents the act of a context becoming idle.

CONCRT_EVENT_ATTACH 

An event type that represents the act of a attaching to a scheduler.

CONCRT_EVENT_DETACH 

An event type that represents the act of a detaching from a scheduler.

5450 {
5454 
5459 
5460  CONCRT_EVENT_START = 1,
5464 
5465  CONCRT_EVENT_END = 2,
5469 
5470  CONCRT_EVENT_BLOCK = 3,
5474 
5479 
5480  CONCRT_EVENT_YIELD = 5,
5484 
5485  CONCRT_EVENT_IDLE = 6,
5489 
5490  CONCRT_EVENT_ATTACH = 7,
5494 
5495  CONCRT_EVENT_DETACH = 8,
5496 };
An event type used for miscellaneous events.
Definition: concrt.h:5455
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
An event type that represents the act of a attaching to a scheduler.
Definition: concrt.h:5490
An event type that represents the act of unblocking a context.
Definition: concrt.h:5475
An event type that represents the act of a detaching from a scheduler.
Definition: concrt.h:5495
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
An event type that represents the act of a context becoming idle.
Definition: concrt.h:5485
An event type that represents the act of a context yielding.
Definition: concrt.h:5480
An event type that represents the act of a context blocking.
Definition: concrt.h:5470

Trace flags for the event types

Enumerator
SchedulerEventFlag 
ContextEventFlag 
VirtualProcessorEventFlag 
ResourceManagerEventFlag 
PPLEventFlag 
AgentEventFlag 
AllEventsFlag 
5628 {
5629  SchedulerEventFlag = 0x1,
5630  ContextEventFlag = 0x2,
5633  PPLEventFlag = 0x10,
5634  AgentEventFlag = 0x20,
5635 
5636  AllEventsFlag = 0xFFFFFFFF
5637 };
Definition: concrt.h:5633
Definition: concrt.h:5632
Definition: concrt.h:5629
Definition: concrt.h:5634
Definition: concrt.h:5636
Definition: concrt.h:5630

The type of a join messaging block.

Enumerator
greedy 

Greedy join messaging blocks immediately accept a message upon propagation. This is more efficient, but has the possibility for live-lock, depending on the network configuration.

non_greedy 

Non-greedy join messaging blocks postpone messages and try and consume them after all have arrived. These are guaranteed to work, but slower.

9118  {
9123 
9124  greedy = 0,
9129 
9130  non_greedy = 1
9131 };
Non-greedy join messaging blocks postpone messages and try and consume them after all have arrived...
Definition: agents.h:9130
Greedy join messaging blocks immediately accept a message upon propagation. This is more efficient...
Definition: agents.h:9124

The valid responses for an offer of a message object to a block.

Enumerator
accepted 

The target accepted the message.

declined 

The target did not accept the message.

postponed 

The target postponed the message.

missed 

The target tried to accept the message, but it was no longer available.

1741 {
1745 
1746  accepted,
1750 
1751  declined,
1755 
1756  postponed,
1760 
1761  missed
1762 };
The target did not accept the message.
Definition: agents.h:1751
The target postponed the message.
Definition: agents.h:1756
The target tried to accept the message, but it was no longer available.
Definition: agents.h:1761
The target accepted the message.
Definition: agents.h:1746

Queuing modes supported for accelerator views

Enumerator
queuing_mode_immediate 
queuing_mode_automatic 
830  {
833 };

Describes the execution status of a task_group or structured_task_group object. A value of this type is returned by numerous methods that wait on tasks scheduled to a task group to complete.

See also
task_group Class, task_group::wait Method, task_group::run_and_wait Method, structured_task_group Class, structured_task_group::wait Method, structured_task_group::run_and_wait Method
Enumerator
not_complete 

The tasks queued to the task_group object have not completed. Note that this value is not presently returned by the Concurrency Runtime.

completed 

The tasks queued to the task_group or structured_task_group object completed successfully.

canceled 

The task_group or structured_task_group object was canceled. One or more tasks may not have executed.

103 {
108 
109  not_complete,
110 
114 
115  completed,
116 
120 
121  canceled
122 };
The tasks queued to the task_group object have not completed. Note that this value is not presently r...
Definition: pplinterface.h:109
The tasks queued to the task_group or structured_task_group object completed successfully.
Definition: pplinterface.h:115
The task_group or structured_task_group object was canceled. One or more tasks may not have executed...
Definition: pplinterface.h:121

Function Documentation

struct Concurrency::__declspec ( novtable  )

Scheduler Interface

38 {
39  virtual void schedule( TaskProc_t, void* ) = 0;
40 };
void(__cdecl * TaskProc_t)(void *)
An elementary abstraction for a task, defined as void (__cdecl * TaskProc_t)(void *)...
Definition: pplinterface.h:32
Concurrency::__declspec ( noreturn  )
inline

Cancels the currently executing task. This function can be called from within the body of a task to abort the task's execution and cause it to enter the canceled state. While it may be used in response to a cancellation request through a cancellation_token, you may also use it by itself, to initiate cancellation of the task that is currently executing.

It is not a supported scenario to call this function if you are not within the body of a task. Doing so will result in undefined behavior such as a crash or a hang in your application.

See also
task Class
132 {
133  _THROW_NCEE(task_canceled, _EMPTY_ARGUMENT);
134 }
#define _THROW_NCEE(x, y)
Definition: xstddef:78
#define _EMPTY_ARGUMENT
Definition: xstddef:82
template<typename _Ty >
Concurrency::__declspec ( noinline  )

Creates a PPL task object. create_task can be used anywhere you would have used a task constructor. It is provided mainly for convenience, because it allows use of the auto keyword while creating tasks.

Template Parameters
_TyThe type of the parameter from which the task is to be constructed.
Parameters
_ParamThe parameter from which the task is to be constructed. This could be a lambda or function object, a task_completion_event object, a different task object, or a Windows::Foundation::IAsyncInfo interface if you are using tasks in your Windows Store app.
Returns
A new task of type T, that is inferred from _Param .

The first overload behaves like a task constructor that takes a single parameter.

The second overload associates the cancellation token provided with the newly created task. If you use this overload you are not allowed to pass in a different task object as the first parameter.

The type of the returned task is inferred from the first parameter to the function. If _Param is a task_completion_event<T>, a task<T>, or a functor that returns either type T or task<T>, the type of the created task is task<T>.

In a Windows Store app, if _Param is of type Windows::Foundation::IAsyncOperation<T>^ or Windows::Foundation::IAsyncOperationWithProgress<T,P>^, or a functor that returns either of those types, the created task will be of type task<T>. If _Param is of type Windows::Foundation::IAsyncAction^ or Windows::Foundation::IAsyncActionWithProgress<P>^, or a functor that returns either of those types, the created task will have type task<void>.

See also
task Class, Task Parallelism (Concurrency Runtime)
Concurrency::__declspec ( deprecated("Concurrency::EnableTracing is a deprecated function.")  )

Enables tracing in the Concurrency Runtime. This function is deprecated because ETW tracing is now on by default.

Returns
If tracing was correctly initiated, S_OK is returned; otherwise, E_NOT_STARTED is returned.
Concurrency::__declspec ( deprecated("Concurrency::DisableTracing is a deprecated function.")  )

Disables tracing in the Concurrency Runtime. This function is deprecated because ETW tracing is unregistered by default.

Returns
If tracing was correctly disabled, S_OK is returned. If tracing was not previously initiated, E_NOT_STARTED is returned
template<typename _Allocator >
_Allocator::pointer Concurrency::_Construct_buffer ( size_t  _N,
_Allocator &  _Alloc 
)
inline
5169 {
5170  typename _Allocator::pointer _P = _Alloc.allocate(_N);
5171 
5172  // If the objects being sorted have trivial default constructors, they do not need to be
5173  // constructed here. This can benefit performance.
5174  if (!std::is_trivially_default_constructible<typename _Allocator::value_type>::value)
5175  {
5176  for (size_t _I = 0; _I < _N; _I++)
5177  {
5178  // Objects being sorted must have a default constructor
5179  typename _Allocator::value_type _T;
5180  _Alloc.construct(_P + _I, std::forward<typename _Allocator::value_type>(_T));
5181  }
5182  }
5183 
5184  return _P;
5185 }
template<typename _Allocator >
void Concurrency::_Destroy_buffer ( typename _Allocator::pointer  _P,
size_t  _N,
_Allocator &  _Alloc 
)
inline
5190 {
5191  // If the objects being sorted have trivial destructors, they do not need to be
5192  // destructed here. This can benefit performance.
5193  if (!std::is_trivially_destructible<typename _Allocator::value_type>::value)
5194  {
5195  for (size_t _I = 0; _I < _N; _I++)
5196  {
5197  _Alloc.destroy(_P + _I);
5198  }
5199  }
5200 
5201  _Alloc.deallocate(_P, _N);
5202 }
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void Concurrency::_Integer_radix_pass ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Random_buffer_iterator &  _Output,
size_t  _Radix,
_Function  _Proj_func 
)
4726 {
4727  if (!_Size)
4728  {
4729  return;
4730  }
4731 
4732  size_t _Pos[256] = {0};
4733 
4734  for (size_t _I = 0; _I < _Size; _I++)
4735  {
4736  ++_Pos[_Radix_key(_Begin[_I], _Radix, _Proj_func)];
4737  }
4738 
4739  for (size_t _I = 1; _I < 256; _I++)
4740  {
4741  _Pos[_I] += _Pos[_I - 1];
4742  }
4743 
4744  // _Size > 0
4745  for (size_t _I = _Size - 1; _I != 0; _I--)
4746  {
4747  _Output[--_Pos[_Radix_key(_Begin[_I], _Radix, _Proj_func)]] = std::move(_Begin[_I]);
4748  }
4749 
4750  _Output[--_Pos[_Radix_key(_Begin[0], _Radix, _Proj_func)]] = std::move(_Begin[0]);
4751 }
size_t _Radix_key(const _Ty &_Val, size_t _Radix, _Function _Proj_func)
Definition: ppl.h:4718
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
_Size
Definition: vcruntime_string.h:36
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void Concurrency::_Integer_radix_sort ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Random_buffer_iterator &  _Output,
size_t  _Radix,
_Function  _Proj_func,
size_t  _Deep = 0 
)
4757 {
4758  size_t _Cur_radix = 0;
4759  if (_Size == 0)
4760  {
4761  return;
4762  }
4763 
4764  while (_Cur_radix < _Radix)
4765  {
4766  _Integer_radix_pass(_Begin, _Size, _Output, _Cur_radix++, _Proj_func);
4767  _Integer_radix_pass(_Output, _Size, _Begin, _Cur_radix++, _Proj_func);
4768  }
4769 
4770  if (_Cur_radix == _Radix)
4771  {
4772  _Integer_radix_pass(_Begin, _Size, _Output, _Cur_radix++, _Proj_func);
4773  }
4774 
4775  // if odd round is passed, then move result back to input buffer
4776  if (_Deep + _Radix + 1 & 1)
4777  {
4778  if (_Radix + 1 & 1)
4779  {
4780  std::_Move_no_deprecate(_Output, _Output + _Size, _Begin);
4781  }
4782  else
4783  {
4784  std::_Move_no_deprecate(_Begin, _Begin + _Size, _Output);
4785  }
4786  }
4787 }
void _Integer_radix_pass(const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func)
Definition: ppl.h:4725
_OutIt _Move_no_deprecate(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2623
_Size
Definition: vcruntime_string.h:36
template<typename _Random_iterator , typename _Function >
size_t Concurrency::_Median_of_nine ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Function &  _Func,
bool _Potentially_equal 
)
inline
4583 {
4584  size_t _Offset = _Size / 8;
4585  size_t _A = _Median_of_three(_Begin, 0, _Offset, _Offset * 2, _Func, _Potentially_equal),
4586  _B = _Median_of_three(_Begin, _Offset * 3, _Offset * 4, _Offset * 5, _Func, _Potentially_equal),
4587  _C = _Median_of_three(_Begin, _Offset * 6, _Offset * 7, _Size - 1, _Func, _Potentially_equal);
4588  _B = _Median_of_three(_Begin, _A, _B, _C, _Func, _Potentially_equal);
4589 
4590  if (_Potentially_equal)
4591  {
4592  _Potentially_equal = !_Func(_Begin[_C], _Begin[_A]);
4593  }
4594 
4595  return _B;
4596 }
size_t _Median_of_three(const _Random_iterator &_Begin, size_t _A, size_t _B, size_t _C, const _Function &_Func, bool &_Potentially_equal)
Definition: ppl.h:4553
_Size
Definition: vcruntime_string.h:36
template<typename _Random_iterator , typename _Function >
size_t Concurrency::_Median_of_three ( const _Random_iterator &  _Begin,
size_t  _A,
size_t  _B,
size_t  _C,
const _Function &  _Func,
bool _Potentially_equal 
)
inline
4554 {
4555  _Potentially_equal = false;
4556  if (_Func(_Begin[_A], _Begin[_B]))
4557  {
4558  if (_Func(_Begin[_A], _Begin[_C]))
4559  {
4560  return _Func(_Begin[_B], _Begin[_C]) ? _B : _C;
4561  }
4562  else
4563  {
4564  return _A;
4565  }
4566  }
4567  else
4568  {
4569  if (_Func(_Begin[_B], _Begin[_C]))
4570  {
4571  return _Func(_Begin[_A], _Begin[_C]) ? _A : _C;
4572  }
4573  else
4574  {
4575  _Potentially_equal = true;
4576  return _B;
4577  }
4578  }
4579 }
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Random_output_iterator , typename _Function >
void Concurrency::_Merge_chunks ( _Random_iterator  _Begin1,
const _Random_iterator &  _End1,
_Random_buffer_iterator  _Begin2,
const _Random_buffer_iterator &  _End2,
_Random_output_iterator  _Output,
const _Function &  _Func 
)
4664 {
4665  while (_Begin1 != _End1 && _Begin2 != _End2)
4666  {
4667  if (_Func(*_Begin1, *_Begin2))
4668  {
4669  *_Output++ = std::move(*_Begin1++);
4670  }
4671  else
4672  {
4673  *_Output++ = std::move(*_Begin2++);
4674  }
4675  }
4676 
4677  if (_Begin1 != _End1)
4678  {
4679  std::_Move_no_deprecate(_Begin1, _End1, _Output);
4680  }
4681  else if (_Begin2 != _End2)
4682  {
4683  std::_Move_no_deprecate(_Begin2, _End2, _Output);
4684  }
4685 }
_OutIt _Move_no_deprecate(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2623
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
bool Concurrency::_Parallel_buffered_sort_impl ( const _Random_iterator &  _Begin,
size_t  _Size,
_Random_buffer_iterator  _Output,
const _Function &  _Func,
int  _Div_num,
const size_t  _Chunk_size 
)
inline
5106 {
5107  static_assert(std::is_same<typename std::iterator_traits<_Random_iterator>::value_type, typename std::iterator_traits<_Random_buffer_iterator>::value_type>::value,
5108  "same value type expected");
5109 
5110  if (_Div_num <= 1 || _Size <= _Chunk_size)
5111  {
5112  _Parallel_quicksort_impl(_Begin, _Size, _Func, _MAX_NUM_TASKS_PER_CORE, _Chunk_size, 0);
5113 
5114  // In case _Size <= _Chunk_size happened BEFORE the planned stop time (when _Div_num == 1) we need to calculate how many turns of
5115  // binary divisions are left. If there are an odd number of turns left, then the buffer move is necessary to make sure the final
5116  // merge result will be in the original input array.
5117  int _Left_div_turns = 0;
5118  while (_Div_num >>= 1)
5119  {
5120  _Left_div_turns++;
5121  }
5122 
5123  if (_Left_div_turns & 1)
5124  {
5125  std::move(_Begin, _Begin + _Size, _Output);
5126  return true;
5127  }
5128  else
5129  {
5130  return false;
5131  }
5132  }
5133  else
5134  {
5135  size_t _Mid = _Size / 2;
5136  structured_task_group _Tg;
5137 
5138  auto _Handle = make_task([&, _Chunk_size]
5139  {
5140  _Parallel_buffered_sort_impl(_Begin, _Mid, _Output, _Func, _Div_num / 2, _Chunk_size);
5141  });
5142  _Tg.run(_Handle);
5143 
5144  bool _Is_buffer_swap = _Parallel_buffered_sort_impl(_Begin + _Mid, _Size - _Mid, _Output + _Mid, _Func, _Div_num / 2, _Chunk_size);
5145 
5146  _Tg.wait();
5147 
5148  if (_Is_buffer_swap)
5149  {
5150  _Parallel_merge(_Output, _Mid, _Output + _Mid, _Size - _Mid, _Begin, _Func, _Div_num);
5151  }
5152  else
5153  {
5154  _Parallel_merge(_Begin, _Mid, _Begin + _Mid, _Size - _Mid, _Output, _Func, _Div_num);
5155  }
5156 
5157  return !_Is_buffer_swap;
5158  }
5159 }
void _Parallel_quicksort_impl(const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, size_t _Div_num, const size_t _Chunk_size, int _Depth)
Definition: ppl.h:4993
task_handle< _Function > make_task(const _Function &_Func)
A factory method for creating a task_handle object.
Definition: ppl.h:165
void _Parallel_merge(_Random_iterator _Begin1, size_t _Len1, _Random_buffer_iterator _Begin2, size_t _Len2, _Random_output_iterator _Output, const _Function &_Func, size_t _Div_num)
Definition: ppl.h:4690
bool _Parallel_buffered_sort_impl(const _Random_iterator &_Begin, size_t _Size, _Random_buffer_iterator _Output, const _Function &_Func, int _Div_num, const size_t _Chunk_size)
Definition: ppl.h:5104
#define _MAX_NUM_TASKS_PER_CORE
Definition: ppl.h:4541
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
_Size
Definition: vcruntime_string.h:36
template<typename _Worker_class , typename _Random_iterator , typename _Index_type , typename _Function , typename _Partitioner >
void Concurrency::_Parallel_chunk_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
const _Index_type &  _Step,
const _Function &  _Func,
_Partitioner &&  _Part 
)
2367 {
2368  _CONCRT_ASSERT(_Range_arg > 1);
2369  _CONCRT_ASSERT(_Step > 0);
2370 
2371  _Index_type _Num_iterations = (_Step == 1) ? _Range_arg : (((_Range_arg - 1) / _Step) + 1);
2372  _CONCRT_ASSERT(_Num_iterations > 1);
2373 
2374  _Index_type _Num_chunks = _Part._Get_num_chunks(_Num_iterations);
2375  _CONCRT_ASSERT(_Num_chunks > 0);
2376 
2377  // Allocate memory on the stack for task_handles to ensure everything is properly structured.
2379  task_handle<_Worker_class> * _Chunk_helpers = _Holder._InitOnRawMalloca(_malloca(sizeof(task_handle<_Worker_class>) * static_cast<size_t>(_Num_chunks)));
2380 
2381  structured_task_group _Task_group;
2382 
2383  _Index_type _Iterations_per_chunk = _Num_iterations / _Num_chunks;
2384  _Index_type _Remaining_iterations = _Num_iterations % _Num_chunks;
2385 
2386  // If there are less iterations than desired chunks, set the chunk number
2387  // to be the number of iterations.
2388  if (_Iterations_per_chunk == 0)
2389  {
2390  _Num_chunks = _Remaining_iterations;
2391  }
2392 
2393  _Index_type _Work_size = 0;
2394  _Index_type _Start_iteration = 0;
2395  _Index_type _I;
2396 
2397  // Split the available work in chunks
2398  for (_I = 0; _I < _Num_chunks - 1; _I++)
2399  {
2400  if (_Remaining_iterations > 0)
2401  {
2402  // Iterations are not divided evenly, so add 1 remainder iteration each time
2403  _Work_size = _Iterations_per_chunk + 1;
2404  _Remaining_iterations--;
2405  }
2406  else
2407  {
2408  _Work_size = _Iterations_per_chunk;
2409  }
2410 
2411  // New up a task_handle "in-place", in the array preallocated on the stack
2412  new(&_Chunk_helpers[_I]) task_handle<_Worker_class>(_Worker_class(_I, _First, _Start_iteration, _Start_iteration + _Work_size, _Step, _Func, std::forward<_Partitioner>(_Part)));
2414 
2415  // Run each of the chunk tasks in parallel
2416  _Parallel_chunk_task_group_run(_Task_group, _Chunk_helpers, std::forward<_Partitioner>(_Part), _I);
2417 
2418  // Prepare for the next iteration
2419  _Start_iteration += _Work_size;
2420  }
2421 
2422  // Because this is the last iteration, then work size might be different
2423  _CONCRT_ASSERT((_Remaining_iterations == 0) || ((_Iterations_per_chunk == 0) && (_Remaining_iterations == 1)));
2424  _Work_size = _Num_iterations - _Start_iteration;
2425 
2426  // New up a task_handle "in-place", in the array preallocated on the stack
2427  new(&_Chunk_helpers[_I]) task_handle<_Worker_class>(_Worker_class(_I, _First, _Start_iteration, _Start_iteration + _Work_size, _Step, _Func, std::forward<_Partitioner>(_Part)));
2429 
2430  _Task_group.run_and_wait(_Chunk_helpers[_I]);
2431 }
void _Parallel_chunk_task_group_run(structured_task_group &_Task_group, task_handle< _Worker_class > *_Chunk_helpers, affinity_partitioner &_Part, _Index_type _I)
Definition: ppl.h:2354
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
void _IncrementConstructedElemsCount()
Definition: concrt.h:1072
_ElemType * _InitOnRawMalloca(void *_MallocaRet)
Definition: concrt.h:1062
template<typename _Worker_class , typename _Random_iterator , typename _Index_type , typename _Function >
void Concurrency::_Parallel_chunk_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
const _Index_type &  _Step,
const _Function &  _Func 
)
2435 {
2436  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, auto_partitioner());
2437 }
template<typename _Worker_class , typename _Index_type , typename Partitioner >
void Concurrency::_Parallel_chunk_task_group_run ( structured_task_group &  _Task_group,
task_handle< _Worker_class > *  _Chunk_helpers,
const Partitioner &  ,
_Index_type  _I 
)
2349 {
2350  _Task_group.run(_Chunk_helpers[_I]);
2351 }
template<typename _Worker_class , typename _Index_type >
void Concurrency::_Parallel_chunk_task_group_run ( structured_task_group &  _Task_group,
task_handle< _Worker_class > *  _Chunk_helpers,
affinity_partitioner &  _Part,
_Index_type  _I 
)
2358 {
2359  _Task_group.run(_Chunk_helpers[_I], _Part._Get_chunk_location(static_cast<unsigned int>(_I)));
2360 }
template<typename _Forward_iterator , typename _Function >
void Concurrency::_Parallel_for_each_chunk ( _Forward_iterator &  _First,
const _Forward_iterator &  _Last,
const _Function &  _Func,
task_group &  _Task_group 
)
2809 {
2810  // The chunk size selection depends more on the internal implementation of parallel_for than
2811  // on the actual input. Also, it does not have to be dynamically computed, but it helps
2812  // parallel_for if it is a power of 2 (easy to divide).
2813  const unsigned int _Chunk_size = 1024;
2814 
2815  // This functor will be copied on the heap and will execute the chunk in parallel
2816  _Parallel_for_each_helper<_Forward_iterator, _Function, _Chunk_size> _Functor(_First, _Last, _Func);
2817 
2818  // Because this is an unstructured task group, running the task will make a copy of the necessary data
2819  // on the heap, ensuring that it is available at the time of execution.
2820  _Task_group.run(_Functor);
2821 }
_FwdIt _Last
Definition: algorithm:1936
template<typename _Forward_iterator , typename _Function >
void Concurrency::_Parallel_for_each_forward_impl ( _Forward_iterator &  _First,
const _Forward_iterator &  _Last,
const _Function &  _Func,
task_group &  _Task_group 
)
2825 {
2826  _Parallel_for_each_chunk(_First, _Last, _Func, _Task_group);
2827 
2828  // If there is a tail, push the tail
2829  if (_First != _Last)
2830  {
2831  _Task_group.run(
2832  [&_First, &_Last, &_Func, &_Task_group]
2833  {
2834  ::Concurrency::_Parallel_for_each_forward_impl(_First, _Last, _Func, _Task_group);
2835  }
2836  );
2837  }
2838 }
void _Parallel_for_each_chunk(_Forward_iterator &_First, const _Forward_iterator &_Last, const _Function &_Func, task_group &_Task_group)
Definition: ppl.h:2808
void _Parallel_for_each_forward_impl(_Forward_iterator &_First, const _Forward_iterator &_Last, const _Function &_Func, task_group &_Task_group)
Definition: ppl.h:2824
_FwdIt _Last
Definition: algorithm:1936
template<typename _Forward_iterator , typename _Function >
void Concurrency::_Parallel_for_each_impl ( _Forward_iterator  _First,
const _Forward_iterator &  _Last,
const _Function &  _Func,
const auto_partitioner &  ,
std::forward_iterator_tag   
)
2842 {
2843  // Because this is a forward iterator, it is difficult to validate that _First comes before _Last, so
2844  // it is up to the user to provide valid range.
2845  if (_First != _Last)
2846  {
2847  task_group _Task_group;
2848 
2849  _Parallel_for_each_forward_impl(_First, _Last, _Func, _Task_group);
2850 
2851  _Task_group.wait();
2852  }
2853 }
void _Parallel_for_each_forward_impl(_Forward_iterator &_First, const _Forward_iterator &_Last, const _Function &_Func, task_group &_Task_group)
Definition: ppl.h:2824
_FwdIt _Last
Definition: algorithm:1936
template<typename _Random_iterator , typename _Function , typename _Partitioner >
void Concurrency::_Parallel_for_each_impl ( const _Random_iterator &  _First,
const _Random_iterator &  _Last,
const _Function &  _Func,
_Partitioner &&  _Part,
std::random_access_iterator_tag   
)
2889 {
2890  typedef typename std::iterator_traits<_Random_iterator>::difference_type _Index_type;
2891 
2892  // Exit early if there is nothing in the collection
2893  if (_First >= _Last)
2894  {
2895  return;
2896  }
2897 
2898  _Index_type _Range_size = _Last - _First;
2899 
2900  if (_Range_size == 1)
2901  {
2902  _Func(*_First);
2903  }
2904  else
2905  {
2906  _Index_type _Step = 1;
2907 
2908  _Parallel_for_each_partitioned_impl(_First, _Range_size, _Step, _Func, std::forward<_Partitioner>(_Part));
2909  }
2910 }
void _Parallel_for_each_partitioned_impl(const _Random_iterator &_First, _Index_type _Range_arg, _Index_type _Step, const _Function &_Func, affinity_partitioner &_Part)
Definition: ppl.h:2880
_FwdIt _Last
Definition: algorithm:1936
template<typename _Random_iterator , typename _Index_type , typename _Function >
void Concurrency::_Parallel_for_each_partitioned_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
_Index_type  _Step,
const _Function &  _Func,
const auto_partitioner &  _Part 
)
2857 {
2858  typedef _Parallel_chunk_helper<_Random_iterator, _Index_type, _Function, auto_partitioner, true> _Worker_class;
2859  // Use the same function that schedules work for parallel for
2860  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2861 }
template<typename _Random_iterator , typename _Index_type , typename _Function >
void Concurrency::_Parallel_for_each_partitioned_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
_Index_type  _Step,
const _Function &  _Func,
const static_partitioner &  _Part 
)
2865 {
2866  typedef _Parallel_fixed_chunk_helper<_Random_iterator, _Index_type, _Function, static_partitioner, true> _Worker_class;
2867  // Use the same function that schedules work for parallel for
2868  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2869 }
template<typename _Random_iterator , typename _Index_type , typename _Function >
void Concurrency::_Parallel_for_each_partitioned_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
_Index_type  _Step,
const _Function &  _Func,
const simple_partitioner &  _Part 
)
2873 {
2874  typedef _Parallel_fixed_chunk_helper<_Random_iterator, _Index_type, _Function, simple_partitioner, true> _Worker_class;
2875  // Use the same function that schedules work for parallel for
2876  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2877 }
template<typename _Random_iterator , typename _Index_type , typename _Function >
void Concurrency::_Parallel_for_each_partitioned_impl ( const _Random_iterator &  _First,
_Index_type  _Range_arg,
_Index_type  _Step,
const _Function &  _Func,
affinity_partitioner &  _Part 
)
2881 {
2882  typedef _Parallel_localized_chunk_helper<_Random_iterator, _Index_type, _Function, true> _Worker_class;
2883  // Use the same function that schedules work for parallel for
2884  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2885 }
template<typename _Index_type , typename _Function , typename _Partitioner >
void Concurrency::_Parallel_for_impl ( _Index_type  _First,
_Index_type  _Last,
_Index_type  _Step,
const _Function &  _Func,
_Partitioner &&  _Part 
)
2474 {
2475  // The step argument must be 1 or greater; otherwise it is an invalid argument
2476  if (_Step < 1)
2477  {
2478  throw std::invalid_argument("_Step");
2479  }
2480 
2481  // If there are no elements in this range we just return
2482  if (_First >= _Last)
2483  {
2484  return;
2485  }
2486 
2487  // Compute the difference type based on the arguments and avoid signed overflow for int, long, and long long
2488  typedef typename std::conditional<std::is_same<_Index_type, int>::value, unsigned int,
2489  typename std::conditional<std::is_same<_Index_type, long>::value, unsigned long,
2490  typename std::conditional<std::is_same<_Index_type, long long>::value, unsigned long long, decltype(_Last - _First)
2491  >::type
2492  >::type
2493  >::type _Diff_type;
2494 
2495  _Diff_type _Range_size = _Diff_type(_Last) - _Diff_type(_First);
2496  _Diff_type _Diff_step = _Step;
2497 
2498  if (_Range_size <= _Diff_step)
2499  {
2500  _Func(_First);
2501  }
2502  else
2503  {
2504  _Parallel_for_partitioned_impl<_Index_type, _Diff_type, _Function>(_First, _Range_size, _Step, _Func, std::forward<_Partitioner>(_Part));
2505  }
2506 }
unsigned int
Definition: vccorlib.h:2468
_FwdIt _Last
Definition: algorithm:1936
template<typename _Index_type , typename _Function >
void Concurrency::_Parallel_for_impl ( _Index_type  _First,
_Index_type  _Last,
_Index_type  _Step,
const _Function &  _Func 
)
2510 {
2511  _Parallel_for_impl(_First, _Last, _Step, _Func, auto_partitioner());
2512 }
void _Parallel_for_impl(_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func)
Definition: ppl.h:2509
_FwdIt _Last
Definition: algorithm:1936
template<typename _Index_type , typename _Diff_type , typename _Function >
void Concurrency::_Parallel_for_partitioned_impl ( _Index_type  _First,
_Diff_type  _Range_arg,
_Diff_type  _Step,
const _Function &  _Func,
const auto_partitioner &  _Part 
)
2442 {
2443  typedef _Parallel_chunk_helper<_Index_type, _Diff_type, _Function, auto_partitioner, false> _Worker_class;
2444  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2445 }
template<typename _Index_type , typename _Diff_type , typename _Function >
void Concurrency::_Parallel_for_partitioned_impl ( _Index_type  _First,
_Diff_type  _Range_arg,
_Diff_type  _Step,
const _Function &  _Func,
const static_partitioner &  _Part 
)
2450 {
2451  typedef _Parallel_fixed_chunk_helper<_Index_type, _Diff_type, _Function, static_partitioner, false> _Worker_class;
2452  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2453 }
template<typename _Index_type , typename _Diff_type , typename _Function >
void Concurrency::_Parallel_for_partitioned_impl ( _Index_type  _First,
_Diff_type  _Range_arg,
_Diff_type  _Step,
const _Function &  _Func,
const simple_partitioner &  _Part 
)
2458 {
2459  typedef _Parallel_fixed_chunk_helper<_Index_type, _Diff_type, _Function, simple_partitioner, false> _Worker_class;
2460  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2461 }
template<typename _Index_type , typename _Diff_type , typename _Function >
void Concurrency::_Parallel_for_partitioned_impl ( _Index_type  _First,
_Diff_type  _Range_arg,
_Diff_type  _Step,
const _Function &  _Func,
affinity_partitioner &  _Part 
)
2467 {
2468  typedef _Parallel_localized_chunk_helper<_Index_type, _Diff_type, _Function, false> _Worker_class;
2469  _Parallel_chunk_impl<_Worker_class>(_First, _Range_arg, _Step, _Func, _Part);
2470 }
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void Concurrency::_Parallel_integer_radix_sort ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Random_buffer_iterator &  _Output,
size_t  _Radix,
_Function  _Proj_func,
const size_t  _Chunk_size,
size_t  _Deep = 0 
)
4794 {
4795  // If the chunk _Size is too small, then turn to serial least-significant-byte radix sort
4796  if (_Size <= _Chunk_size || _Radix < 1)
4797  {
4798  return _Integer_radix_sort(_Begin, _Size, _Output, _Radix, _Proj_func, _Deep);
4799  }
4800 
4802  size_t _Buffer_size = sizeof(size_t) * 256 * _Threads_num;
4803  size_t _Step = _Size / _Threads_num;
4804  size_t _Remain = _Size % _Threads_num;
4805 
4807  size_t (*_Chunks)[256] = _Holder._InitOnRawMalloca(_malloca(_Buffer_size));
4808 
4809  memset(_Chunks, 0, _Buffer_size);
4810 
4811  // Our purpose is to map unsorted data in buffer "_Begin" to buffer "_Output" so that all elements who have the same
4812  // byte value in the "_Radix" position will be grouped together in the buffer "_Output"
4813  //
4814  // Serial version:
4815  // To understand this algorithm, first consider a serial version. In following example, we treat 1 digit as 1 byte, so we have a
4816  // total of 10 elements for each digit instead of 256 elements in each byte. Let's suppose "_Radix" == 1 (right most is 0), and:
4817  //
4818  // begin: [ 32 | 62 | 21 | 43 | 55 | 43 | 23 | 44 ]
4819  //
4820  // We want to divide the output buffer "_Output" into 10 chunks, and each the element in the "_Begin" buffer should be mapped into
4821  // the proper destination chunk based on its current digit (byte) indicated by "_Radix"
4822  //
4823  // Because "_Radix" == 1, after a pass of this function, the chunks in the "_Output" should look like:
4824  //
4825  // buffer: [ | | 21 23 | 32 | 43 43 44 | 55 | 62 | | | ]
4826  // 0 1 2 3 4 5 6 7 8 9
4827  //
4828  // The difficulty is determining where to insert values into the "_Output" to get the above result. The way to get the
4829  // start position of each chunk of the buffer is:
4830  // 1. Count the number of elements for each chunk (in above example, chunk0 is 0, chunk1 is 0, chunk2 is 2, chunk3 is 1 ...
4831  // 2. Make a partial sum for these chunks( in above example, we will get chunk0=chunk0=0, chunk1=chunk0+chunk1=0,
4832  // chunk2=chunk0+chunk1+chunk2=2, chunk3=chunk0+chunk1+chunk2+chunk3=3
4833  //
4834  // After these steps, we will get the end position of each chunk in the "_Output". The begin position of each chunk will be the end
4835  // point of last chunk (begin point is close but the end point is open). After that, we can scan the original array again and directly
4836  // put elements from original buffer "_Begin" into specified chunk on buffer "_Output".
4837  // Finally, we invoke _parallel_integer_radix_sort in parallel for each chunk and sort them in parallel based on the next digit (byte).
4838  // Because this is a STABLE sort algorithm, if two numbers has same key value on this byte (digit), their original order should be kept.
4839  //
4840  // Parallel version:
4841  // Almost the same as the serial version, the differences are:
4842  // 1. The count for each chunk is executed in parallel, and each thread will count one segment of the input buffer "_Begin".
4843  // The count result will be separately stored in their own chunk size counting arrays so we have a total of threads-number
4844  // of chunk count arrays.
4845  // For example, we may have chunk00, chunk01, ..., chunk09 for first thread, chunk10, chunk11, ..., chunk19 for second thread, ...
4846  // 2. The partial sum should be executed across these chunk counting arrays that belong to different threads, instead of just
4847  // making a partial sum in one counting array.
4848  // This is because we need to put values from different segments into one final buffer, and the absolute buffer position for
4849  // each chunkXX is needed.
4850  // 3. Make a parallel scan for original buffer again, and move numbers in parallel into the corresponding chunk on each buffer based
4851  // on these threads' chunk size counters.
4852 
4853  // Count in parallel and separately save their local results without reducing
4854  ::Concurrency::parallel_for(static_cast<size_t>(0), _Threads_num, [=](size_t _Index)
4855  {
4856  size_t _Beg_index, _End_index;
4857 
4858  // Calculate the segment position
4859  if (_Index < _Remain)
4860  {
4861  _Beg_index = _Index * (_Step + 1);
4862  _End_index = _Beg_index + (_Step + 1);
4863  }
4864  else
4865  {
4866  _Beg_index = _Remain * (_Step + 1) + (_Index - _Remain) * _Step;
4867  _End_index = _Beg_index + _Step;
4868  }
4869 
4870  // Do a counting
4871  while (_Beg_index != _End_index)
4872  {
4873  ++_Chunks[_Index][_Radix_key(_Begin[_Beg_index++], _Radix, _Proj_func)];
4874  }
4875  });
4876 
4877  int _Index = -1, _Count = 0;
4878 
4879  // Partial sum cross different threads' chunk counters
4880  for (int _I = 0; _I < 256; _I++)
4881  {
4882  size_t _Last = _I ? _Chunks[_Threads_num - 1][_I - 1] : 0;
4883  _Chunks[0][_I] += _Last;
4884 
4885  for (size_t _J = 1; _J < _Threads_num; _J++)
4886  {
4887  _Chunks[_J][_I] += _Chunks[_J - 1][_I];
4888  }
4889 
4890  // "_Chunks[_Threads_num - 1][_I] - _Last" will get the global _Size for chunk _I(including all threads local _Size for chunk _I)
4891  // this will chunk whether the chunk _I is empty or not. If it's not empty, it will be recorded.
4892  if (_Chunks[_Threads_num - 1][_I] - _Last)
4893  {
4894  ++_Count;
4895  _Index = _I;
4896  }
4897  }
4898 
4899  // If there is more than 1 chunk that has content, then continue the original algorithm
4900  if (_Count > 1)
4901  {
4902  // Move the elements in parallel into each chunk
4903  ::Concurrency::parallel_for(static_cast<size_t>(0), _Threads_num, [=](size_t _Index)
4904  {
4905  size_t _Beg_index, _End_index;
4906 
4907  // Calculate the segment position
4908  if (_Index < _Remain)
4909  {
4910  _Beg_index = _Index * (_Step + 1);
4911  _End_index = _Beg_index + (_Step + 1);
4912  }
4913  else
4914  {
4915  _Beg_index = _Remain * (_Step + 1) + (_Index - _Remain) * _Step;
4916  _End_index = _Beg_index + _Step;
4917  }
4918 
4919  // Do a move operation to directly put each value into its destination chunk
4920  // Chunk pointer is moved after each put operation.
4921  if (_Beg_index != _End_index--)
4922  {
4923  while (_Beg_index != _End_index)
4924  {
4925  _Output[--_Chunks[_Index][_Radix_key(_Begin[_End_index], _Radix, _Proj_func)]] = std::move(_Begin[_End_index]);
4926  --_End_index;
4927  }
4928  _Output[--_Chunks[_Index][_Radix_key(_Begin[_End_index], _Radix, _Proj_func)]] = std::move(_Begin[_End_index]);
4929  }
4930  });
4931 
4932  // Invoke _parallel_integer_radix_sort in parallel for each chunk
4933  ::Concurrency::parallel_for(static_cast<size_t>(0), static_cast<size_t>(256), [=](size_t _Index)
4934  {
4935  if (_Index < 256 - 1)
4936  {
4937  _Parallel_integer_radix_sort(_Output + _Chunks[0][_Index], _Chunks[0][_Index + 1] - _Chunks[0][_Index],
4938  _Begin + _Chunks[0][_Index], _Radix - 1, _Proj_func, _Chunk_size, _Deep + 1);
4939  }
4940  else
4941  {
4942  _Parallel_integer_radix_sort(_Output + _Chunks[0][_Index], _Size - _Chunks[0][_Index],
4943  _Begin + _Chunks[0][_Index], _Radix - 1, _Proj_func, _Chunk_size, _Deep + 1);
4944  }
4945  });
4946  }
4947  else
4948  {
4949  // Only one chunk has content
4950  // A special optimization is applied because one chunk means all numbers have a same value on this particular byte (digit).
4951  // Because we cannot sort them at all (they are all equal at this point), directly call _parallel_integer_radix_sort to
4952  // sort next byte (digit)
4953  _Parallel_integer_radix_sort(_Begin, _Size, _Output, _Radix - 1, _Proj_func, _Chunk_size, _Deep);
4954  }
4955 }
unsigned int _Count
Definition: xcomplex:668
void _Parallel_integer_radix_sort(const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func, const size_t _Chunk_size, size_t _Deep=0)
Definition: ppl.h:4792
void _Integer_radix_sort(const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func, size_t _Deep=0)
Definition: ppl.h:4755
_ElemType * _InitOnRawMalloca(void *_MallocaRet)
Definition: concrt.h:1062
unsigned int size_t
Definition: sourceannotations.h:19
size_t _Radix_key(const _Ty &_Val, size_t _Radix, _Function _Proj_func)
Definition: ppl.h:4718
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
static _CONCRTIMP unsigned int __cdecl _GetNumberOfVirtualProcessors()
_FwdIt _Last
Definition: algorithm:1936
_Size
Definition: vcruntime_string.h:36
void parallel_for(_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2747
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
void Concurrency::_Parallel_integer_sort_asc ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Random_buffer_iterator &  _Output,
_Function  _Proj_func,
const size_t  _Chunk_size 
)
4960 {
4961  typedef typename std::iterator_traits<_Random_iterator>::value_type _Value_type;
4962  // The key type of the radix sort, this must be an "unsigned integer-like" type, that is, it needs support:
4963  // operator>> (int), operator>>= (int), operator& (int), operator <, operator size_t ()
4964  typedef typename std::remove_const<typename std::remove_reference<decltype(_Proj_func(*_Begin))>::type>::type _Integer_type;
4965 
4966  // Find out the max value, which will be used to determine the highest differing byte (the radix position)
4967  _Integer_type _Max_val = ::Concurrency::parallel_reduce(_Begin, _Begin + _Size, _Proj_func(*_Begin),
4968  [=](_Random_iterator _Begin, _Random_iterator _End, _Integer_type _Init) -> _Integer_type
4969  {
4970  while (_Begin != _End)
4971  {
4972  _Integer_type _Ret = _Proj_func(*_Begin++);
4973  if (_Init < _Ret)
4974  {
4975  _Init = _Ret;
4976  }
4977  }
4978 
4979  return _Init;
4980  }, [](const _Integer_type &_A, const _Integer_type &_B) -> const _Integer_type& {return (_A < _B)? _B : _A;});
4981  size_t _Radix = 0;
4982 
4983  // Find out highest differing byte
4984  while (_Max_val >>= 8)
4985  {
4986  ++_Radix;
4987  }
4988 
4989  _Parallel_integer_radix_sort(_Begin, _Size, _Output, _Radix, _Proj_func, _Chunk_size);
4990 }
std::iterator_traits< _Forward_iterator >::value_type parallel_reduce(_Forward_iterator _Begin, _Forward_iterator _End, const typename std::iterator_traits< _Forward_iterator >::value_type &_Identity)
Computes the sum of all elements in a specified range by computing successive partial sums...
Definition: ppl.h:3287
void _Parallel_integer_radix_sort(const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, size_t _Radix, _Function _Proj_func, const size_t _Chunk_size, size_t _Deep=0)
Definition: ppl.h:4792
_Size
Definition: vcruntime_string.h:36
template<typename _Function1 , typename _Function2 >
void Concurrency::_Parallel_invoke_impl ( const _Function1 &  _Func1,
const _Function2 &  _Func2 
)
909 {
910  structured_task_group _Task_group;
911 
912  task_handle<_Function1> _Task_handle1(_Func1);
913  _Task_group.run(_Task_handle1);
914 
915  // We inline the last item to prevent the unnecessary push/pop on the work queue.
916  task_handle<_Function2> _Task_handle2(_Func2);
917  _Task_group.run_and_wait(_Task_handle2);
918 }
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Random_output_iterator , typename _Function >
void Concurrency::_Parallel_merge ( _Random_iterator  _Begin1,
size_t  _Len1,
_Random_buffer_iterator  _Begin2,
size_t  _Len2,
_Random_output_iterator  _Output,
const _Function &  _Func,
size_t  _Div_num 
)
4692 {
4693  // Turn to serial merge or continue splitting chunks base on "_Div_num"
4694  if (_Div_num <= 1 || (_Len1 <= 1 && _Len2 <= 1))
4695  {
4696  _Merge_chunks(_Begin1, _Begin1 + _Len1, _Begin2, _Begin2 + _Len2, _Output, _Func);
4697  }
4698  else
4699  {
4700  size_t _Mid_len1 = _Len1, _Mid_len2 = _Len2;
4701  size_t _Mid = _Search_mid_point(_Begin1, _Mid_len1, _Begin2, _Mid_len2, _Func);
4702 
4703  structured_task_group _Tg;
4704  auto _Handle = make_task([&]
4705  {
4706  _Parallel_merge(_Begin1, _Mid_len1, _Begin2, _Mid_len2, _Output, _Func, _Div_num / 2);
4707  });
4708  _Tg.run(_Handle);
4709 
4710  _Parallel_merge(_Begin1 + _Mid_len1, _Len1 - _Mid_len1, _Begin2 + _Mid_len2, _Len2 - _Mid_len2, _Output + _Mid, _Func, _Div_num / 2);
4711 
4712  _Tg.wait();
4713  }
4714 }
task_handle< _Function > make_task(const _Function &_Func)
A factory method for creating a task_handle object.
Definition: ppl.h:165
void _Parallel_merge(_Random_iterator _Begin1, size_t _Len1, _Random_buffer_iterator _Begin2, size_t _Len2, _Random_output_iterator _Output, const _Function &_Func, size_t _Div_num)
Definition: ppl.h:4690
size_t _Search_mid_point(const _Random_iterator &_Begin1, size_t &_Len1, const _Random_buffer_iterator &_Begin2, size_t &_Len2, const _Function &_Func)
Definition: ppl.h:4617
void _Merge_chunks(_Random_iterator _Begin1, const _Random_iterator &_End1, _Random_buffer_iterator _Begin2, const _Random_buffer_iterator &_End2, _Random_output_iterator _Output, const _Function &_Func)
Definition: ppl.h:4662
template<typename _Random_iterator , typename _Function >
void Concurrency::_Parallel_quicksort_impl ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Function &  _Func,
size_t  _Div_num,
const size_t  _Chunk_size,
int  _Depth 
)
4994 {
4995  if (_Depth >= _SORT_MAX_RECURSION_DEPTH || _Size <= _Chunk_size || _Size <= static_cast<size_t>(3) || _Chunk_size >= _FINE_GRAIN_CHUNK_SIZE && _Div_num <= 1)
4996  {
4997  return std::sort(_Begin, _Begin + _Size, _Func);
4998  }
4999 
5000  // Determine whether we need to do a three-way quick sort
5001  // We benefit from three-way merge if there are a lot of elements that are EQUAL to the median value,
5002  // _Select_median_pivot function will test redundant density by sampling
5003  bool _Is_three_way_split = false;
5004  size_t _Mid_index = _Select_median_pivot(_Begin, _Size, _Func, _Chunk_size, _Is_three_way_split);
5005 
5006  // Move the median value to the _Begin position.
5007  if (_Mid_index)
5008  {
5009  std::swap(*_Begin, _Begin[_Mid_index]);
5010  }
5011  size_t _I = 1, _J = _Size - 1;
5012 
5013  // Three-way or two-way partition
5014  // _Div_num < _MAX_NUM_TASKS_PER_CORE is checked to make sure it will never do three-way split before splitting enough tasks
5015  if (_Is_three_way_split && _Div_num < _MAX_NUM_TASKS_PER_CORE)
5016  {
5017  while (_Func(*_Begin, _Begin[_J]))
5018  {
5019  --_J;
5020  }
5021 
5022  while (_Func(_Begin[_I], *_Begin))
5023  {
5024  ++_I;
5025  }
5026 
5027  // Starting from this point, left side of _I will less than median value, right side of _J will be greater than median value,
5028  // and the middle part will be equal to median. _K is used to scan between _I and _J
5029  size_t _K = _J;
5030  while (_I <= _K)
5031  {
5032  if (_Func(_Begin[_K], *_Begin))
5033  {
5034  std::swap(_Begin[_I++], _Begin[_K]);
5035  }
5036  else
5037  {
5038  --_K;
5039  }
5040 
5041  while (_Func(*_Begin, _Begin[_K]))
5042  {
5043  std::swap(_Begin[_K--], _Begin[_J--]);
5044  }
5045  }
5046 
5047  ++_J;
5048  }
5049  else
5050  {
5051  while (_I <= _J)
5052  {
5053  // Will stop before _Begin
5054  while (_Func(*_Begin, _Begin[_J]))
5055  {
5056  --_J;
5057  }
5058 
5059  // There must be another element equal or greater than *_Begin
5060  while (_Func(_Begin[_I], *_Begin))
5061  {
5062  ++_I;
5063  }
5064 
5065  if (_I < _J)
5066  {
5067  std::swap(_Begin[_I++], _Begin[_J--]);
5068  }
5069  else
5070  {
5071  break;
5072  }
5073  }
5074 
5075  _I = ++_J;
5076  }
5077 
5078  std::swap(*_Begin, _Begin[--_I]);
5079 
5080  structured_task_group _Tg;
5081  volatile size_t _Next_div = _Div_num / 2;
5082  auto _Handle = make_task([&]
5083  {
5084  _Parallel_quicksort_impl(_Begin + _J, _Size - _J, _Func, _Next_div, _Chunk_size, _Depth+1);
5085  });
5086  _Tg.run(_Handle);
5087 
5088  _Parallel_quicksort_impl(_Begin, _I, _Func, _Next_div, _Chunk_size, _Depth+1);
5089 
5090  // If at this point, the work hasn't been scheduled, then slow down creating new tasks
5091  if (_Div_num < _MAX_NUM_TASKS_PER_CORE)
5092  {
5093  _Next_div /= 2;
5094  }
5095 
5096  _Tg.wait();
5097 }
void _Parallel_quicksort_impl(const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, size_t _Div_num, const size_t _Chunk_size, int _Depth)
Definition: ppl.h:4993
size_t _Select_median_pivot(const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, const size_t _Chunk_size, bool &_Potentially_equal)
Definition: ppl.h:4600
task_handle< _Function > make_task(const _Function &_Func)
A factory method for creating a task_handle object.
Definition: ppl.h:165
void swap(array< _Ty, _Size > &_Left, array< _Ty, _Size > &_Right) _NOEXCEPT_OP(_NOEXCEPT_OP(_Left.swap(_Right)))
Definition: array:433
#define _FINE_GRAIN_CHUNK_SIZE
Definition: ppl.h:4547
#define _SORT_MAX_RECURSION_DEPTH
Definition: ppl.h:4550
#define _MAX_NUM_TASKS_PER_CORE
Definition: ppl.h:4541
_Size
Definition: vcruntime_string.h:36
void sort(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2781
template<typename _Forward_iterator , typename _Function >
void Concurrency::_Parallel_reduce_forward_executor ( _Forward_iterator  _First,
_Forward_iterator  _Last,
const _Function &  _Func,
task_group &  _Task_group 
)
3463 {
3464  const static int _Internal_worker_number = 1024, _Default_chunk_size = 512;
3465  typedef _Parallel_reduce_fixed_worker<_Forward_iterator, _Function> _Worker_class;
3466 
3467  structured_task_group _Worker_group;
3469  task_handle<_Worker_class>* _Workers = _Holder._InitOnRawMalloca(_malloca(_Internal_worker_number * sizeof(task_handle<_Worker_class>)));
3470 
3471  // Start execution first
3472  int _Index = 0;
3473  while (_Index < _Internal_worker_number && _First != _Last)
3474  {
3475  // Copy the range _Head
3476  _Forward_iterator _Head = _First;
3477 
3478  // Read from forward iterator
3479  for (size_t _I = 0; _I < _Default_chunk_size && _First != _Last; ++_I, ++_First)
3480  {
3481  // Body is empty
3482  };
3483 
3484  // Create a new task, _First is range _End
3485  new (_Workers + _Index) task_handle<_Worker_class>(_Worker_class(_Head, _First, _Func));
3487  _Worker_group.run(_Workers[_Index]);
3488  ++_Index;
3489  }
3490 
3491  // Divide and append the left
3492  while (_First != _Last)
3493  {
3494  _Task_group.run(_Parallel_reduce_forward_executor_helper<_Forward_iterator, _Function, _Internal_worker_number, _Default_chunk_size>(_First, _Last, _Func));
3495  }
3496 
3497  _Worker_group.wait();
3498 }
void _IncrementConstructedElemsCount()
Definition: concrt.h:1072
_ElemType * _InitOnRawMalloca(void *_MallocaRet)
Definition: concrt.h:1062
_FwdIt _Last
Definition: algorithm:1936
template<typename _Forward_iterator , typename _Function >
_Function::_Reduce_type Concurrency::_Parallel_reduce_impl ( _Forward_iterator  _First,
const _Forward_iterator &  _Last,
const _Function &  _Func,
std::forward_iterator_tag   
)
3297 {
3298  // Because this is a forward iterator, it is difficult to validate that _First comes before _Last, so
3299  // it is up to the user to provide valid range.
3300  if (_First != _Last)
3301  {
3302  task_group _Task_group;
3303  _Parallel_reduce_forward_executor(_First, _Last, _Func, _Task_group);
3304  _Task_group.wait();
3305  return _Func._Combinable._Serial_combine_release();
3306  }
3307  else
3308  {
3309  return _Func._Identity_value;
3310  }
3311 }
_FwdIt _Last
Definition: algorithm:1936
void _Parallel_reduce_forward_executor(_Forward_iterator _First, _Forward_iterator _Last, const _Function &_Func, task_group &_Task_group)
Definition: ppl.h:3462
template<typename _Random_iterator , typename _Function >
_Function::_Reduce_type Concurrency::_Parallel_reduce_impl ( _Random_iterator  _First,
_Random_iterator  _Last,
const _Function &  _Func,
std::random_access_iterator_tag   
)
3342 {
3343  typedef _Parallel_reduce_fixed_worker<_Random_iterator, _Function> _Worker_class;
3344 
3345  // Special case for 0, 1 element
3346  if (_First >= _Last)
3347  {
3348  return _Func._Identity_value;
3349  }
3350  // Directly compute if size is too small
3351  else if (_Last - _First <= 1)
3352  {
3353  _Worker_class(_First, _Last, _Func)();
3354  return _Func._Combinable._Serial_combine_release();
3355  }
3356  else
3357  {
3358  // Use fixed ordered chunk partition to schedule works
3359  _Parallel_reduce_random_executor<_Worker_class>(_First, _Last, _Func);
3360  return _Func._Combinable._Serial_combine_release();
3361  }
3362 }
_FwdIt _Last
Definition: algorithm:1936
template<typename _Worker , typename _Random_iterator , typename _Function >
void Concurrency::_Parallel_reduce_random_executor ( _Random_iterator  _Begin,
_Random_iterator  _End,
const _Function &  _Fun 
)
3369 {
3370  size_t _Cpu_num = static_cast<size_t>(::Concurrency::details::_CurrentScheduler::_GetNumberOfVirtualProcessors()), _Size = _End - _Begin;
3371 
3372  structured_task_group _Tg;
3374  task_handle<_Worker> *_Tasks = _Holder._InitOnRawMalloca(_malloca(sizeof(task_handle<_Worker>) * (_Cpu_num - 1)));
3375 
3376  size_t _Begin_index = 0;
3377  size_t _Step = _Size / _Cpu_num;
3378  size_t _NumRemaining = _Size - _Step * _Cpu_num;
3379 
3380  for(size_t _I = 0; _I < _Cpu_num - 1; _I++)
3381  {
3382  size_t _Next = _Begin_index + _Step;
3383 
3384  // Add remaining to each chunk
3385  if (_NumRemaining)
3386  {
3387  --_NumRemaining;
3388  ++_Next;
3389  }
3390 
3391  // New up a task_handle "in-place", in the array preallocated on the stack
3392  new (_Tasks + _I) task_handle<_Worker>(_Worker(_Begin + _Begin_index, _Begin + _Next, _Fun));
3394 
3395  // Run each of the chunk _Tasks in parallel
3396  _Tg.run(_Tasks[_I]);
3397  _Begin_index = _Next;
3398  }
3399 
3400  task_handle<_Worker> _Tail(_Worker(_Begin + _Begin_index, _End, _Fun));
3401  _Tg.run_and_wait(_Tail);
3402 }
void _IncrementConstructedElemsCount()
Definition: concrt.h:1072
_ElemType * _InitOnRawMalloca(void *_MallocaRet)
Definition: concrt.h:1062
static _CONCRTIMP unsigned int __cdecl _GetNumberOfVirtualProcessors()
_Size
Definition: vcruntime_string.h:36
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator >
void Concurrency::_Parallel_transform_binary_impl2 ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Input_iterator2  _First2,
_Output_iterator &  _Result,
const _Binary_operator&  _Binary_op,
task_group &  _Tg 
)
3717 {
3718  // This functor will be copied on the heap and will execute the chunk in parallel
3719  {
3720  _Parallel_transform_binary_helper<_Input_iterator1, _Input_iterator2, _Output_iterator, _Binary_operator> _Functor(_First1, _Last1, _First2, _Result, _Binary_op);
3721  _Tg.run(_Functor);
3722  }
3723 
3724  // If there is a tail, push the tail
3725  if (_First1 != _Last1)
3726  {
3727  _Tg.run(
3728  [=, &_Result, &_Binary_op, &_Tg]
3729  {
3730  _Parallel_transform_binary_impl2(_First1, _Last1, _First2, _Result, _Binary_op, _Tg);
3731  });
3732  }
3733 }
void _Parallel_transform_binary_impl2(_Input_iterator1 _First1, _Input_iterator1 _Last1, _Input_iterator2 _First2, _Output_iterator &_Result, const _Binary_operator&_Binary_op, task_group &_Tg)
Definition: ppl.h:3715
template<typename _Input_iterator , typename _Output_iterator , typename _Unary_operator , typename _Partitioner >
_Output_iterator Concurrency::_Parallel_transform_unary_impl ( _Input_iterator  _First,
_Input_iterator  _Last,
_Output_iterator  _Result,
const _Unary_operator&  _Unary_op,
_Partitioner &&  _Part 
)
3789 {
3790  typedef typename std::iterator_traits<_Input_iterator>::iterator_category _Input_iterator_type;
3791  typedef typename std::iterator_traits<_Output_iterator>::iterator_category _Output_iterator_type;
3792 
3793  if (_First != _Last)
3794  {
3796  ::_Parallel_transform_unary_impl(_First, _Last, _Result, _Unary_op, std::forward<_Partitioner>(_Part));
3797  }
3798 
3799  return _Result;
3800 }
_FwdIt _Last
Definition: algorithm:1936
_Output_iterator _Parallel_transform_unary_impl(_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
Definition: ppl.h:3788
template<typename _Input_iterator , typename _Output_iterator , typename _Unary_operator >
void Concurrency::_Parallel_transform_unary_impl2 ( _Input_iterator  _First,
_Input_iterator  _Last,
_Output_iterator &  _Result,
const _Unary_operator&  _Unary_op,
task_group &  _Tg 
)
3769 {
3770  // This functor will be copied on the heap and will execute the chunk in parallel
3771  {
3772  _Parallel_transform_unary_helper<_Input_iterator, _Output_iterator, _Unary_operator> _Functor(_First, _Last, _Result, _Unary_op);
3773  _Tg.run(_Functor);
3774  }
3775 
3776  // If there is a tail, push the tail
3777  if (_First != _Last)
3778  {
3779  _Tg.run(
3780  [=, &_Result, &_Unary_op, &_Tg]
3781  {
3782  _Parallel_transform_unary_impl2(_First, _Last, _Result, _Unary_op, _Tg);
3783  });
3784  }
3785 }
_FwdIt _Last
Definition: algorithm:1936
void _Parallel_transform_unary_impl2(_Input_iterator _First, _Input_iterator _Last, _Output_iterator &_Result, const _Unary_operator&_Unary_op, task_group &_Tg)
Definition: ppl.h:3767
template<typename _Ty , typename _Function >
size_t Concurrency::_Radix_key ( const _Ty &  _Val,
size_t  _Radix,
_Function  _Proj_func 
)
inline
4719 {
4720  return static_cast<size_t>(_Proj_func(_Val) >> static_cast<int>(8 * _Radix) & 255);
4721 }
_In_ int _Val
Definition: vcruntime_string.h:62
template<class _Type >
_Type Concurrency::_Receive_impl ( ISource< _Type > *  _Src,
unsigned int  _Timeout,
typename ITarget< _Type >::filter_method const *  _Filter_proc 
)

A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted. If the specified timeout is not COOPERATIVE_TIMEOUT_INFINITE, an exception (operation_timed_out) will be thrown if the specified amount of time expires before a message is received. Note that zero length timeouts should likely use try_receive as opposed to receive with a timeout of zero as it is more efficient and does not throw exceptions on timeouts.

Template Parameters
_TypeThe payload type
Parameters
_SrcA pointer to the source from which data is expected.
_TimeoutThe maximum time for which the method should for the data, in milliseconds.
_Filter_procA pointer to a filter which will indicate whether to accept the data or not.
Returns
A value from the source, of the payload type.
2809 {
2810  // The Blocking Recipient messaging block class is internal to the receive function
2811  class _Blocking_recipient : public ITarget<_Type>
2812  {
2813  public:
2814  // Create an Blocking Recipient
2815  _Blocking_recipient(ISource<_Type> * _PSource,
2816  unsigned int _Timeout = COOPERATIVE_TIMEOUT_INFINITE) :
2817  _M_pFilter(NULL), _M_pConnectedTo(NULL), _M_pMessage(NULL), _M_fState(_NotInitialized), _M_timeout(_Timeout)
2818  {
2819  _Connect(_PSource);
2820  }
2821 
2822  // Create an Blocking Recipient
2823  _Blocking_recipient(ISource<_Type> * _PSource,
2824  filter_method const& _Filter,
2825  unsigned int _Timeout = COOPERATIVE_TIMEOUT_INFINITE) :
2826  _M_pFilter(NULL), _M_pConnectedTo(NULL), _M_pMessage(NULL), _M_fState(_NotInitialized), _M_timeout(_Timeout)
2827  {
2828  if (_Filter != NULL)
2829  {
2830  _M_pFilter = new filter_method(_Filter);
2831  }
2832 
2833  _Connect(_PSource);
2834  }
2835 
2836  // Cleans up any resources that may have been created by the BlockingRecipient.
2837  ~_Blocking_recipient()
2838  {
2839  _Disconnect();
2840 
2841  delete _M_pFilter;
2842  delete _M_pMessage;
2843  }
2844 
2845  // Gets the value of the message sent to this BlockingRecipient. Blocks by
2846  // spinning until a message has arrived.
2847  _Type _Value()
2848  {
2849  _Wait_for_message();
2850 
2851  return _M_pMessage->payload;
2852  }
2853 
2854  // The main propagation function for ITarget blocks. Called by a source
2855  // block, generally within an asynchronous task to send messages to its targets.
2856  virtual message_status propagate(message<_Type> * _PMessage, ISource<_Type> * _PSource)
2857  {
2858  // Throw exception if the message being propagated to this block is NULL
2859  if (_PMessage == NULL)
2860  {
2861  throw std::invalid_argument("_PMessage");
2862  }
2863 
2864  if (_PSource == NULL)
2865  {
2866  throw std::invalid_argument("_PSource");
2867  }
2868 
2869  // Reject if the recipient has already received a message
2870  if (_M_fState == _Initialized)
2871  {
2872  return declined;
2873  }
2874 
2875  // Reject if the message does not meet the filter requirements
2876  if (_M_pFilter != NULL && !(*_M_pFilter)(_PMessage->payload))
2877  {
2878  return declined;
2879  }
2880 
2881  // Accept the message
2882  _CONCRT_ASSERT(_PSource != NULL);
2883  _M_pMessage = _PSource->accept(_PMessage->msg_id(), this);
2884 
2885  if (_M_pMessage != NULL)
2886  {
2887  // Set the initialized flag on this block
2888  if (_InterlockedExchange(&_M_fState, _Initialized) == _Blocked)
2889  {
2890  _M_ev.set();
2891  }
2892 
2893  return accepted;
2894  }
2895 
2896  return missed;
2897  }
2898 
2899  // Synchronously sends a message to this block. When this function completes the message will
2900  // already have propagated into the block.
2901  virtual message_status send(message<_Type> * _PMessage, ISource<_Type> * _PSource)
2902  {
2903  if (_PMessage == NULL)
2904  {
2905  throw std::invalid_argument("_PMessage");
2906  }
2907 
2908  if (_PSource == NULL)
2909  {
2910  throw std::invalid_argument("_PSource");
2911  }
2912 
2913  // Only the connected source is allowed to send messages
2914  // to the blocking recipient. Decline messages without
2915  // a source.
2916 
2917  return declined;
2918  }
2919 
2920  private:
2921 
2922  // Link a source block
2923  virtual void link_source(ISource<_Type> * _PSrc)
2924  {
2925  _M_pConnectedTo = _PSrc;
2926  _PSrc->acquire_ref(this);
2927  }
2928 
2929  // Remove a source messaging block for this BlockingRecipient
2930  virtual void unlink_source(ISource<_Type> * _PSource)
2931  {
2932  if (_InterlockedCompareExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (void *)NULL, _PSource) == _PSource)
2933  {
2934  _PSource->release_ref(this);
2935  }
2936  }
2937 
2938  // Remove the source messaging block for this BlockingRecipient
2939  virtual void unlink_sources()
2940  {
2941  ISource<_Type> * _PSource = reinterpret_cast<ISource<_Type> *>(_InterlockedExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (void *)NULL));
2942  if (_PSource != NULL)
2943  {
2944  _PSource->unlink_target(this);
2945  _PSource->release_ref(this);
2946  }
2947  }
2948 
2949 
2950  // Connect the blocking recipient to the source
2951  void _Connect(ISource<_Type> * _PSource)
2952  {
2953  if (_PSource == NULL)
2954  {
2955  throw std::invalid_argument("_PSource");
2956  }
2957 
2958  _PSource->link_target(this);
2959  }
2960 
2961  // Cleanup the connection to the blocking recipient's source. There is no need
2962  // to do anything about the associated context.
2963  void _Disconnect()
2964  {
2965  unlink_sources();
2966  }
2967 
2968  // Internal function used to block while waiting for a message to arrive
2969  // at this BlockingRecipient
2970  void _Wait_for_message()
2971  {
2972  bool _Timeout = false;
2973 
2974  // If we haven't received a message yet, cooperatively block.
2975  if (_InterlockedCompareExchange(&_M_fState, _Blocked, _NotInitialized) == _NotInitialized)
2976  {
2977  if (_M_ev.wait(_M_timeout) == COOPERATIVE_WAIT_TIMEOUT)
2978  {
2979  _Timeout = true;
2980  }
2981  }
2982 
2983  // Unlinking from our source guarantees that there are no threads in propagate
2984  _Disconnect();
2985 
2986  if (_M_fState != _Initialized)
2987  {
2988  // We had to have timed out if we came out of the wait
2989  // without being initialized.
2990  _CONCRT_ASSERT(_Timeout);
2991 
2992  throw operation_timed_out();
2993  }
2994  }
2995 
2996  // States for this block
2997  enum
2998  {
2999  _NotInitialized,
3000  _Blocked,
3001  _Initialized
3002  };
3003 
3004  volatile long _M_fState;
3005 
3006  // The source messaging block connected to this Recipient
3007  ISource<_Type> * _M_pConnectedTo;
3008 
3009  // The message that was received
3010  message<_Type> * volatile _M_pMessage;
3011 
3012  // The timeout.
3013  unsigned int _M_timeout;
3014 
3015  // The event we wait upon
3016  event _M_ev;
3017 
3018  // The filter that is called on this block before accepting a message
3019  filter_method * _M_pFilter;
3020  };
3021 
3022  if (_Filter_proc != NULL)
3023  {
3024  _Blocking_recipient _Recipient(_Src, *_Filter_proc, _Timeout);
3025  return _Recipient._Value();
3026  }
3027  else
3028  {
3029  _Blocking_recipient _Recipient(_Src, _Timeout);
3030  return _Recipient._Value();
3031  }
3032 }
#define NULL
Definition: vcruntime.h:236
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
The target did not accept the message.
Definition: agents.h:1751
bool send(ITarget< _Type > &_Trg, const _Type &_Data)
A synchronous send operation, which waits until the target either accepts or declines the message...
Definition: agents.h:4366
message_status
The valid responses for an offer of a message object to a block.
Definition: agents.h:1740
The target tried to accept the message, but it was no longer available.
Definition: agents.h:1761
The target accepted the message.
Definition: agents.h:1746
void * _InterlockedCompareExchangePointer(void *volatile *, void *, void *)
const unsigned int COOPERATIVE_TIMEOUT_INFINITE
Value indicating that a wait should never time out.
Definition: concrt.h:3478
const size_t COOPERATIVE_WAIT_TIMEOUT
Value indicating that a wait timed out.
Definition: concrt.h:3469
_In_ int _Value
Definition: setjmp.h:173
long __cdecl _InterlockedCompareExchange(long volatile *, long, long)
template<typename _Random_iterator , typename _Random_buffer_iterator , typename _Function >
size_t Concurrency::_Search_mid_point ( const _Random_iterator &  _Begin1,
size_t _Len1,
const _Random_buffer_iterator &  _Begin2,
size_t _Len2,
const _Function &  _Func 
)
4618 {
4619  size_t _Len = (_Len1 + _Len2) / 2, _Index1 = 0, _Index2 = 0;
4620 
4621  while (_Index1 < _Len1 && _Index2 < _Len2)
4622  {
4623  size_t _Mid1 = (_Index1 + _Len1) / 2, _Mid2 = (_Index2 + _Len2) / 2;
4624  if (_Func(_Begin1[_Mid1], _Begin2[_Mid2]))
4625  {
4626  if (_Mid1 + _Mid2 < _Len)
4627  {
4628  _Index1 = _Mid1 + 1;
4629  }
4630  else
4631  {
4632  _Len2 = _Mid2;
4633  }
4634  }
4635  else
4636  {
4637  if (_Mid1 + _Mid2 < _Len)
4638  {
4639  _Index2 = _Mid2 + 1;
4640  }
4641  else
4642  {
4643  _Len1 = _Mid1;
4644  }
4645  }
4646  }
4647 
4648  if (_Index1 == _Len1)
4649  {
4650  _Len2 = _Len - _Len1;
4651  }
4652  else
4653  {
4654  _Len1 = _Len - _Len2;
4655  }
4656 
4657  return _Len;
4658 }
template<typename _Random_iterator , typename _Function >
size_t Concurrency::_Select_median_pivot ( const _Random_iterator &  _Begin,
size_t  _Size,
const _Function &  _Func,
const size_t  _Chunk_size,
bool _Potentially_equal 
)
inline
4601 {
4602  // Base on different chunk size, apply different sampling optimization
4603  if (_Chunk_size < _FINE_GRAIN_CHUNK_SIZE && _Size <= std::max<size_t>(_Chunk_size * 4, static_cast<size_t>(15)))
4604  {
4605  bool _Never_care_equal;
4606  return _Median_of_three(_Begin, 0, _Size / 2, _Size - 1, _Func, _Never_care_equal);
4607  }
4608  else
4609  {
4610  return _Median_of_nine(_Begin, _Size, _Func, _Potentially_equal);
4611  }
4612 }
#define _FINE_GRAIN_CHUNK_SIZE
Definition: ppl.h:4547
size_t _Median_of_nine(const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, bool &_Potentially_equal)
Definition: ppl.h:4582
size_t _Median_of_three(const _Random_iterator &_Begin, size_t _A, size_t _B, size_t _C, const _Function &_Func, bool &_Potentially_equal)
Definition: ppl.h:4553
_Size
Definition: vcruntime_string.h:36
_CONCRTIMP void __cdecl Concurrency::_Trace_agents ( Agents_EventType  _Type,
__int64  _AgentId,
  ... 
)
_CONCRTIMP void __cdecl Concurrency::_Trace_ppl_function ( const GUID &  _Guid,
unsigned char  _Level,
ConcRT_EventType  _Type 
)
template<class _Type >
bool Concurrency::_Try_receive_impl ( ISource< _Type > *  _Src,
_Type &  _value,
typename ITarget< _Type >::filter_method const *  _Filter_proc 
)

Helper function that implements try_receive A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, try_receive will return false.

Template Parameters
_TypeThe payload type
Parameters
_SrcA pointer to the source from which data is expected.
_valueA reference to a location where the result will be placed.
_Filter_procA pointer to a filter which will indicate whether to accept the data or not.
Returns
A bool indicating whether a payload was placed in _value or not.
3200 {
3201  // The Immediate Recipient messaging block class is internal to the receive function
3202  class _Immediate_recipient : public ITarget<_Type>
3203  {
3204  public:
3205  // Create an Immediate Recipient
3206  _Immediate_recipient(ISource<_Type> * _PSource) :
3207  _M_pFilter(NULL), _M_pConnectedTo(NULL), _M_pMessage(NULL), _M_isInitialized(0)
3208  {
3209  _Connect(_PSource);
3210  }
3211 
3212  // Create an Immediate Recipient
3213  _Immediate_recipient(ISource<_Type> * _PSource,
3214  filter_method const& _Filter) :
3215  _M_pFilter(NULL), _M_pConnectedTo(NULL), _M_pMessage(NULL), _M_isInitialized(0)
3216  {
3217  if (_Filter != NULL)
3218  {
3219  _M_pFilter = new filter_method(_Filter);
3220  }
3221 
3222  _Connect(_PSource);
3223  }
3224 
3225  // Cleans up any resources that may have been created by the ImmediateRecipient.
3226  ~_Immediate_recipient()
3227  {
3228  _Disconnect();
3229 
3230  delete _M_pFilter;
3231  delete _M_pMessage;
3232  }
3233 
3234  // Gets the value of the message sent to this ImmediateRecipient.
3235  bool _Value(_Type & _value)
3236  {
3237  // Unlinking from our source guarantees that there are no threads in propagate
3238  _Disconnect();
3239 
3240  if (_M_pMessage != NULL)
3241  {
3242  _value = _M_pMessage->payload;
3243  return true;
3244  }
3245 
3246  return false;
3247  }
3248 
3249  // The main propagation function for ITarget blocks. Called by a source
3250  // block, generally within an asynchronous task to send messages to its targets.
3251  virtual message_status propagate(message<_Type> * _PMessage, ISource<_Type> * _PSource)
3252  {
3253  message_status _Result = accepted;
3254 
3255  // Throw exception if the message being propagated to this block is NULL
3256  if (_PMessage == NULL)
3257  {
3258  throw std::invalid_argument("_PMessage");
3259  }
3260 
3261  if (_PSource == NULL)
3262  {
3263  throw std::invalid_argument("_PSource");
3264  }
3265 
3266  // Reject if the recipient has already received a message
3267  if (_M_isInitialized == 1)
3268  {
3269  return declined;
3270  }
3271 
3272  // Reject if the message does not meet the filter requirements
3273  if (_M_pFilter != NULL && !(*_M_pFilter)(_PMessage->payload))
3274  {
3275  return declined;
3276  }
3277 
3278  // Accept the message
3279  _CONCRT_ASSERT(_PSource != NULL);
3280  _M_pMessage = _PSource->accept(_PMessage->msg_id(), this);
3281 
3282  // Set the initialized flag on this block
3283 
3284  if (_M_pMessage != NULL)
3285  {
3286  // Fence to ensure that the above update to _M_pMessage is visible
3287  _InterlockedExchange(&_M_isInitialized, 1);
3288  _Result = accepted;
3289  }
3290  else
3291  {
3292  _Result = missed;
3293  }
3294 
3295  return _Result;
3296  }
3297 
3298 
3299  // Synchronously sends a message to this block. When this function completes the message will
3300  // already have propagated into the block.
3301  virtual message_status send(message<_Type> * _PMessage, ISource<_Type> * _PSource)
3302  {
3303  if (_PMessage == NULL)
3304  {
3305  throw std::invalid_argument("_PMessage");
3306  }
3307 
3308  if (_PSource == NULL)
3309  {
3310  throw std::invalid_argument("_PSource");
3311  }
3312 
3313  // Only the connected source is allowed to send messages
3314  // to the blocking recipient. Decline messages without
3315  // a source.
3316 
3317  return declined;
3318  }
3319 
3320  private:
3321 
3322  // Add a source messaging block
3323  virtual void link_source(ISource<_Type> * _PSrc)
3324  {
3325  _M_pConnectedTo = _PSrc;
3326  _PSrc->acquire_ref(this);
3327  }
3328 
3329  // Remove a source messaging block for this BlockingRecipient
3330  virtual void unlink_source(ISource<_Type> * _PSource)
3331  {
3332  if (_InterlockedCompareExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (void *)NULL, _PSource) == _PSource)
3333  {
3334  _PSource->release_ref(this);
3335  }
3336  }
3337 
3338  // Remove the source messaging block for this BlockingRecipient
3339  virtual void unlink_sources()
3340  {
3341  ISource<_Type> * _PSource = reinterpret_cast<ISource<_Type> *>(_InterlockedExchangePointer(reinterpret_cast<void *volatile *>(&_M_pConnectedTo), (void *)NULL));
3342  if (_PSource != NULL)
3343  {
3344  _PSource->unlink_target(this);
3345  _PSource->release_ref(this);
3346  }
3347  }
3348 
3349  // Connect to a source block
3350  void _Connect(ISource<_Type> * _PSource)
3351  {
3352  if (_PSource == NULL)
3353  {
3354  throw std::invalid_argument("_PSource");
3355  }
3356 
3357  _CONCRT_ASSERT(_M_isInitialized == 0);
3358 
3359  _PSource->link_target(this);
3360  }
3361 
3362  //
3363  // Cleanup the connection to the trigger's source. There is no need
3364  // to do anything about the associated context.
3365  //
3366  void _Disconnect()
3367  {
3368  unlink_sources();
3369  }
3370 
3371  // The source messaging block connected to this Recipient
3372  ISource<_Type> * _M_pConnectedTo;
3373 
3374  // The message that was received
3375  message<_Type> * volatile _M_pMessage;
3376 
3377  // A flag for whether or not this block has been initialized with a value
3378  volatile long _M_isInitialized;
3379 
3380  // The filter that is called on this block before accepting a message
3381  filter_method * _M_pFilter;
3382  };
3383 
3384  if (_Filter_proc != NULL)
3385  {
3386  _Immediate_recipient _Recipient(_Src, *_Filter_proc);
3387  return _Recipient._Value(_value);
3388  }
3389  else
3390  {
3391  _Immediate_recipient _Recipient(_Src);
3392  return _Recipient._Value(_value);
3393  }
3394 }
#define NULL
Definition: vcruntime.h:236
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
The target did not accept the message.
Definition: agents.h:1751
bool send(ITarget< _Type > &_Trg, const _Type &_Data)
A synchronous send operation, which waits until the target either accepts or declines the message...
Definition: agents.h:4366
message_status
The valid responses for an offer of a message object to a block.
Definition: agents.h:1740
The target tried to accept the message, but it was no longer available.
Definition: agents.h:1761
The target accepted the message.
Definition: agents.h:1746
void * _InterlockedCompareExchangePointer(void *volatile *, void *, void *)
_In_ int _Value
Definition: setjmp.h:173
void Concurrency::all_memory_fence ( const tile_barrier &  _Barrier)
inline

Memory fences and tile barriers.

Ensures that memory accesses are visible to other threads in the thread tile, and are executed according to program order

Parameters
_BarrierA tile_barrier object
7179 {
7181 }
void __dp_d3d_all_memory_fence() __GPU_ONLY
_CONCRTIMP void* __cdecl Concurrency::Alloc ( size_t  _NumBytes)

Allocates a block of memory of the size specified from the Concurrency Runtime Caching Suballocator.

Parameters
_NumBytesThe number of bytes of memory to allocate.
Returns
A pointer to newly allocated memory.

For more information about which scenarios in your application could benefit from using the Caching Suballocator, see Task Scheduler (Concurrency Runtime).

See also
Concurrency::Free Function
_AMPIMP void __cdecl Concurrency::amp_uninitialize ( )

Uninitializes the C++ AMP runtime. It is legal to call this function multiple times during an applications lifetime. Calling any C++ AMP API afer calling this function will reinitialize the C++ AMP runtime. Note that it is illegal to use C++ AMP objects across calls to this function and doing so will result in undefined behavior. Also, concurrently calling this function and any other AMP APIs is illegal and would result in undefined behavior.

template<class _Type >
bool Concurrency::asend ( _Inout_ ITarget< _Type > *  _Trg,
const _Type &  _Data 
)

An asynchronous send operation, which schedules a task to propagate the data to the target block.

Template Parameters
_TypeThe type of the data to be sent.
Parameters
_TrgA pointer or reference to the target to which data is sent.
_DataA reference to the data to be sent.
Returns
true if the message was accepted before the method returned, false otherwise.

For more information, see Message Passing Functions.

See also
receive Function, try_receive Function, send Function
4395 {
4396  return details::_Originator::_asend(_Trg, _Data);
4397 }
template<class _Type >
bool Concurrency::asend ( ITarget< _Type > &  _Trg,
const _Type &  _Data 
)

An asynchronous send operation, which schedules a task to propagate the value to the target block.

Template Parameters
_TypeThe type of the data to be sent.
Parameters
_TrgA pointer or reference to the target to which data is sent.
_DataA reference to the data to be sent.
Returns
true if the message was accepted, false otherwise.

For more information, see Message Passing Functions.

See also
receive Function, try_receive Function, send Function
4424 {
4425  return ::Concurrency::asend(&_Trg, _Data);
4426 }
bool asend(ITarget< _Type > &_Trg, const _Type &_Data)
An asynchronous send operation, which schedules a task to propagate the value to the target block...
Definition: agents.h:4423
bool Concurrency::atomic_compare_exchange ( _Inout_ int *  _Dest,
_Inout_ int *  _Expected_value,
int  _Value 
)
inline

Atomically, compares the value pointed to by _Dest for equality with that pointed to by _Expected_value, and if true, returns true and replaces the value with _Value, and if false, returns false and updates the value pointed to by _Expected_value with the value pointed to by _Dest

Parameters
_DestPointer to the destination location
_Expected_valuePointer to the the value being compared to the value pointed to by _Dest. If the comparison is unsuccessful, the value is updated with the value pointed to by _Dest
_ValueThe value to be stored to the location pointed to by _Dest if the comparison is successful
Returns
If the operation is successful, return true. Otherwise, false
6776 {
6777  int _Old = *_Expected_value;
6778  unsigned int _Ret = __dp_d3d_interlocked_compare_exchange(AS_UINT_PTR(_Dest), AS_UINT(_Value), AS_UINT(_Old));
6779  if (_Ret == AS_UINT(_Old))
6780  {
6781  return true;
6782  }
6783  else
6784  {
6785  *_Expected_value = AS_INT(_Ret);
6786  return false;
6787  }
6788 }
#define AS_UINT(v)
Definition: amp.h:6547
#define AS_INT(v)
Definition: amp.h:6548
#define AS_UINT_PTR(p)
Definition: amp.h:6546
unsigned int __dp_d3d_interlocked_compare_exchange(_Inout_ unsigned int *, unsigned int, unsigned int) __GPU_ONLY
_In_ int _Value
Definition: setjmp.h:173
bool Concurrency::atomic_compare_exchange ( _Inout_ unsigned int *  _Dest,
_Inout_ unsigned int *  _Expected_value,
unsigned int  _Value 
)
inline

Atomically, compares the value pointed to by _Dest for equality with that pointed to by _Expected_value, and if true, returns true and replaces the value with _Value, and if false, returns false and updates the value pointed to by _Expected_value with the value pointed to by _Dest

Parameters
_DestPointer to the destination location
_Expected_valuePointer to the the value being compared to the value pointed to by _Dest. If the comparison is unsuccessful, the value is updated with the value pointed to by _Dest
_ValueThe value to be stored to the location pointed to by _Dest if the comparison is successful
Returns
If the operation is successful, return true. Otherwise, false
6809 {
6810  unsigned int _Old = *_Expected_value;
6811  unsigned int _Ret = __dp_d3d_interlocked_compare_exchange(_Dest, _Value, _Old);
6812  if (_Ret == _Old)
6813  {
6814  return true;
6815  }
6816  else
6817  {
6818  *_Expected_value = _Ret;
6819  return false;
6820  }
6821 }
unsigned int __dp_d3d_interlocked_compare_exchange(_Inout_ unsigned int *, unsigned int, unsigned int) __GPU_ONLY
_In_ int _Value
Definition: setjmp.h:173
int Concurrency::atomic_exchange ( _Inout_ int *  _Dest,
int  _Value 
)
inline

Sets the value of location pointed to by _Dest to _Value as an atomic operation

Parameters
_DestPointer to the destination location
_ValueThe value to be set to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6717 {
6718  unsigned int _Ret = __dp_d3d_interlocked_exchange(AS_UINT_PTR(_Dest), AS_UINT(_Value));
6719  return AS_INT(_Ret);
6720 }
#define AS_UINT(v)
Definition: amp.h:6547
#define AS_INT(v)
Definition: amp.h:6548
unsigned int __dp_d3d_interlocked_exchange(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT_PTR(p)
Definition: amp.h:6546
_In_ int _Value
Definition: setjmp.h:173
unsigned int Concurrency::atomic_exchange ( _Inout_ unsigned int *  _Dest,
unsigned int  _Value 
)
inline

Sets the value of location pointed to by _Dest to _Value as an atomic operation

Parameters
_DestPointer to the destination location
_ValueThe value to be set to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6735 {
6736  return __dp_d3d_interlocked_exchange(_Dest, _Value);
6737 }
unsigned int __dp_d3d_interlocked_exchange(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
_In_ int _Value
Definition: setjmp.h:173
float Concurrency::atomic_exchange ( _Inout_ float *  _Dest,
float  _Value 
)
inline

Sets the value of location pointed to by _Dest to _Value as an atomic operation

Parameters
_DestPointer to the destination location
_ValueThe value to be set to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6752 {
6753  unsigned int _Ret = __dp_d3d_interlocked_exchange(AS_UINT_PTR(_Dest), AS_UINT(_Value));
6754  return AS_FLOAT(_Ret);
6755 }
#define AS_UINT(v)
Definition: amp.h:6547
unsigned int __dp_d3d_interlocked_exchange(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT_PTR(p)
Definition: amp.h:6546
#define AS_FLOAT(v)
Definition: amp.h:6549
_In_ int _Value
Definition: setjmp.h:173
int Concurrency::atomic_fetch_add ( _Inout_ int *  _Dest,
int  _Value 
)
inline

Performs an atomic addition of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to be added to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6564 {
6565  unsigned int _Ret;
6567  return AS_INT(_Ret);
6568 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT(v)
Definition: amp.h:6547
#define AS_INT(v)
Definition: amp.h:6548
#define AS_UINT_PTR(p)
Definition: amp.h:6546
_In_ int _Value
Definition: setjmp.h:173
unsigned int Concurrency::atomic_fetch_add ( _Inout_ unsigned int *  _Dest,
unsigned int  _Value 
)
inline

Performs an atomic addition of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to be added to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6583 {
6584  return __dp_d3d_interlocked_add(_Dest, _Value);
6585 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
_In_ int _Value
Definition: setjmp.h:173
int Concurrency::atomic_fetch_and ( _Inout_ int *  _Dest,
int  _Value 
)
inline

Performs an atomic bitwise and operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise and to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6909 {
6910  unsigned int _Ret;
6912  return AS_INT(_Ret);
6913 }
#define AS_UINT(v)
Definition: amp.h:6547
unsigned int __dp_d3d_interlocked_and(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_INT(v)
Definition: amp.h:6548
#define AS_UINT_PTR(p)
Definition: amp.h:6546
_In_ int _Value
Definition: setjmp.h:173
unsigned int Concurrency::atomic_fetch_and ( _Inout_ unsigned int *  _Dest,
unsigned int  _Value 
)
inline

Performs an atomic bitwise and operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise and to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6928 {
6929  return __dp_d3d_interlocked_and(_Dest, _Value);
6930 }
unsigned int __dp_d3d_interlocked_and(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
_In_ int _Value
Definition: setjmp.h:173
int Concurrency::atomic_fetch_dec ( _Inout_ int *  _Dest)
inline

Performs an atomic decrement to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
Returns
The original value of the location pointed to by _Dest
6674 {
6675 #pragma warning( push )
6676 #pragma warning( disable : 4146 )
6677  // Warning 4146: unary minus operator applied to unsigned type, result
6678  // still unsigned.
6679  unsigned int _Ret;
6680  _Ret = __dp_d3d_interlocked_add(AS_UINT_PTR(_Dest), (-(1U)));
6681  return AS_INT(_Ret);
6682 #pragma warning( pop )
6683 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_INT(v)
Definition: amp.h:6548
#define AS_UINT_PTR(p)
Definition: amp.h:6546
unsigned int Concurrency::atomic_fetch_dec ( _Inout_ unsigned int *  _Dest)
inline

Performs an atomic decrement to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
Returns
The original value of the location pointed to by _Dest
6695 {
6696 #pragma warning( push )
6697 #pragma warning( disable : 4146 )
6698  // Warning 4146: unary minus operator applied to unsigned type, result
6699  // still unsigned.
6700  return __dp_d3d_interlocked_add(_Dest, (-(1U)));
6701 #pragma warning( pop )
6702 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
int Concurrency::atomic_fetch_inc ( _Inout_ int *  _Dest)
inline

Performs an atomic increment to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
Returns
The original value of the location pointed to by _Dest
6644 {
6645  unsigned int _Ret;
6646  _Ret = __dp_d3d_interlocked_add(AS_UINT_PTR(_Dest), 1U);
6647  return AS_INT(_Ret);
6648 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_INT(v)
Definition: amp.h:6548
#define AS_UINT_PTR(p)
Definition: amp.h:6546
unsigned int Concurrency::atomic_fetch_inc ( _Inout_ unsigned int *  _Dest)
inline

Performs an atomic increment to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
Returns
The original value of the location pointed to by _Dest
6660 {
6661  return __dp_d3d_interlocked_add(_Dest, 1U);
6662 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
int Concurrency::atomic_fetch_max ( _Inout_ int *  _Dest,
int  _Value 
)
inline

Atomically computes the maximum of _Value and the value of the memory location pointed to by _Dest, and stores the maximum value to the memory location

Parameters
_DestPointer to the destination location
_ValueThe value to be compared to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6837 {
6838  return __dp_d3d_interlocked_max_int(_Dest, _Value);
6839 }
_In_ int _Value
Definition: setjmp.h:173
int __dp_d3d_interlocked_max_int(_Inout_ int *, int) __GPU_ONLY
unsigned int Concurrency::atomic_fetch_max ( _Inout_ unsigned int *  _Dest,
unsigned int  _Value 
)
inline

Atomically computes the maximum of _Value and the value of the memory location pointed to by _Dest, and stores the maximum value to the memory location

Parameters
_DestPointer to the destination location
_ValueThe value to be compared to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6855 {
6856  return __dp_d3d_interlocked_max_uint(_Dest, _Value);
6857 }
unsigned int __dp_d3d_interlocked_max_uint(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
_In_ int _Value
Definition: setjmp.h:173
int Concurrency::atomic_fetch_min ( _Inout_ int *  _Dest,
int  _Value 
)
inline

Atomically computes the minimum of _Value and the value of the memory location pointed to by _Dest, and stores the minimum value to the memory location

Parameters
_DestPointer to the destination location
_ValueThe value to be compared to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6874 {
6875  return __dp_d3d_interlocked_min_int(_Dest, _Value);
6876 }
int __dp_d3d_interlocked_min_int(_Inout_ int *, int) __GPU_ONLY
_In_ int _Value
Definition: setjmp.h:173
unsigned int Concurrency::atomic_fetch_min ( _Inout_ unsigned int *  _Dest,
unsigned int  _Value 
)
inline

Atomically computes the minimum of _Value and the value of the memory location pointed to by _Dest, and stores the minimum value to the memory location

Parameters
_DestPointer to the destination location
_ValueThe value to be compared to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6892 {
6893  return __dp_d3d_interlocked_min_uint(_Dest, _Value);
6894 }
unsigned int __dp_d3d_interlocked_min_uint(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
_In_ int _Value
Definition: setjmp.h:173
int Concurrency::atomic_fetch_or ( _Inout_ int *  _Dest,
int  _Value 
)
inline

Performs an atomic bitwise or operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise or to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6946 {
6947  unsigned int _Ret;
6949  return AS_INT(_Ret);
6950 }
unsigned int __dp_d3d_interlocked_or(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT(v)
Definition: amp.h:6547
#define AS_INT(v)
Definition: amp.h:6548
#define AS_UINT_PTR(p)
Definition: amp.h:6546
_In_ int _Value
Definition: setjmp.h:173
unsigned int Concurrency::atomic_fetch_or ( _Inout_ unsigned int *  _Dest,
unsigned int  _Value 
)
inline

Performs an atomic bitwise or operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise or to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6965 {
6966  return __dp_d3d_interlocked_or(_Dest, _Value);
6967 }
unsigned int __dp_d3d_interlocked_or(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
_In_ int _Value
Definition: setjmp.h:173
int Concurrency::atomic_fetch_sub ( _Inout_ int *  _Dest,
int  _Value 
)
inline

Performs an atomic subtraction of _Value from the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to be subtracted from the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6600 {
6601  unsigned int _Ret;
6602  int _Neg = -_Value;
6603  _Ret = __dp_d3d_interlocked_add(AS_UINT_PTR(_Dest), AS_UINT(_Neg));
6604  return AS_INT(_Ret);
6605 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT(v)
Definition: amp.h:6547
#define AS_INT(v)
Definition: amp.h:6548
#define AS_UINT_PTR(p)
Definition: amp.h:6546
_In_ int _Value
Definition: setjmp.h:173
unsigned int Concurrency::atomic_fetch_sub ( _Inout_ unsigned int *  _Dest,
unsigned int  _Value 
)
inline

Performs an atomic subtraction of _Value from the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to be subtracted from the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6621 {
6622 #pragma warning( push )
6623 #pragma warning( disable : 4146 )
6624  // Warning 4146: unary minus operator applied to unsigned type, result
6625  // still unsigned.
6626  //
6627  // This is what we want here. The resulted unsigned value have the
6628  // right binary representation for achieving subtraction
6629  return __dp_d3d_interlocked_add(_Dest, (-_Value));
6630 #pragma warning( pop )
6631 }
unsigned int __dp_d3d_interlocked_add(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
_In_ int _Value
Definition: setjmp.h:173
int Concurrency::atomic_fetch_xor ( _Inout_ int *  _Dest,
int  _Value 
)
inline

Performs an atomic bitwise xor operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise xor to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
6982 {
6983  unsigned int _Ret;
6985  return AS_INT(_Ret);
6986 }
unsigned int __dp_d3d_interlocked_xor(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
#define AS_UINT(v)
Definition: amp.h:6547
#define AS_INT(v)
Definition: amp.h:6548
#define AS_UINT_PTR(p)
Definition: amp.h:6546
_In_ int _Value
Definition: setjmp.h:173
unsigned int Concurrency::atomic_fetch_xor ( _Inout_ unsigned int *  _Dest,
unsigned int  _Value 
)
inline

Performs an atomic bitwise xor operation of _Value to the memory location pointed to by _Dest

Parameters
_DestPointer to the destination location
_ValueThe value to bitwise xor to the location pointed to by _Dest
Returns
The original value of the location pointed to by _Dest
7001 {
7002  return __dp_d3d_interlocked_xor(_Dest, _Value);
7003 }
unsigned int __dp_d3d_interlocked_xor(_Inout_ unsigned int *, unsigned int) __GPU_ONLY
_In_ int _Value
Definition: setjmp.h:173
template<class _Ty >
bool Concurrency::await_ready ( const task< _Ty > &  _Task)
174  {
175  return _Task.is_done();
176  }
template<class _Ty >
auto Concurrency::await_resume ( const task< _Ty > &  _Task)
189  {
190  return _Task.get();
191  }
template<class _Ty , typename _Handle >
void Concurrency::await_suspend ( task< _Ty > &  _Task,
_Handle  _ResumeCb 
)
180  {
181  _Task.then([_ResumeCb](task<_Ty>&)
182  {
183  _ResumeCb();
184  }, task_continuation_context::get_current_winrt_context());
185  }
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array< _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array into the destination array.

Parameters
_SrcThe source array.
_DestThe destination array.
6009 {
6012  sizeof(_Value_type) * _Src.extent.size());
6013 
6014  _Copy_async_impl(_Src, _Dest)._Get();
6015 
6017 }
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
constexpr size_type size() const _NOEXCEPT
Definition: array:111
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename InputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( InputIterator  _SrcFirst,
InputIterator  _SrcLast,
array< _Value_type, _Rank > &  _Dest 
)

Copies the elements in the range [_SrcFirst, _SrcLast) into the destination array.

Parameters
_SrcFirstA beginning iterator into the source container.
_SrcLastAn ending iterator into the source container.
_DestThe destination array.
6058 {
6059  auto _Span_id = details::_Get_amp_trace()->_Start_copy_event_helper(nullptr,
6061  sizeof(_Value_type) * std::distance(_SrcFirst, _SrcLast));
6062 
6063  _Copy_async_impl(_SrcFirst, _SrcLast, _Dest)._Get();
6064 
6066 }
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename InputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( InputIterator  _SrcFirst,
array< _Value_type, _Rank > &  _Dest 
)

Copies the elements beginning at _SrcFirst into the destination array.

Parameters
_SrcFirstA beginning iterator into the source container; if the number of available container elements starting at this iterator position is less than _Dest.extent.size(), undefined behavior results.
_DestThe destination array.
6099 {
6100  InputIterator _SrcLast = _SrcFirst;
6101  std::advance(_SrcLast, _Dest.extent.size());
6102  copy(_SrcFirst, _SrcLast, _Dest);
6103 }
_OutIt copy(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2369
constexpr size_type size() const _NOEXCEPT
Definition: array:111
void advance(_InIt &_Where, _Diff _Off)
Definition: xutility:1089
template<typename OutputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( const array< _Value_type, _Rank > &  _Src,
OutputIterator  _DestIter 
)

Copies the contents of the array into the destination beginning at _DestIter.

Parameters
_SrcThe source array.
_DestIterAn output iterator to the beginning position at destination.
6139 {
6140  _CPP_AMP_VERIFY_MUTABLE_ITERATOR(OutputIterator);
6141 
6143  nullptr,
6144  sizeof(_Value_type) * _Src.extent.size());
6145 
6146  _Copy_async_impl(_Src, _DestIter)._Get();
6147 
6149 }
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
constexpr size_type size() const _NOEXCEPT
Definition: array:111
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
#define _CPP_AMP_VERIFY_MUTABLE_ITERATOR(_Type_name)
Definition: xxamp.h:27
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array< _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array into the destination array_view.

Parameters
_SrcThe source array.
_DestThe destination array_view.
6184 {
6187  sizeof(_Value_type) * _Src.extent.size());
6188 
6189  _Copy_async_impl(_Src, _Dest)._Get();
6190 
6192 }
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
constexpr size_type size() const _NOEXCEPT
Definition: array:111
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array_view< const _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array_view into the destination array.

Parameters
_SrcThe source array_view.
_DestThe destination array.
6227 {
6230  sizeof(_Value_type) * _Src.extent.size());
6231 
6232  _Copy_async_impl(_Src, _Dest)._Get();
6233 
6235 }
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array_view< _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array_view into the destination array.

Parameters
_SrcThe source array_view.
_DestThe destination array.
6264 {
6265  copy<_Value_type, _Rank>(array_view<const _Value_type, _Rank>(_Src), _Dest);
6266 }
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array_view< const _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array_view into the destination array_view.

Parameters
_SrcThe source array_view.
_DestThe destination array_view.
6301 {
6304  sizeof(_Value_type) * _Src.extent.size());
6305 
6306  _Copy_async_impl(_Src, _Dest)._Get();
6307 
6309 }
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type , int _Rank>
void Concurrency::copy ( const array_view< _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Copies the contents of the source array_view into the destination array_view.

Parameters
_SrcThe source array_view.
_DestThe destination array_view.
6338 {
6339  copy<_Value_type, _Rank>(array_view<const _Value_type, _Rank>(_Src), _Dest);
6340 }
template<typename InputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( InputIterator  _SrcFirst,
InputIterator  _SrcLast,
const array_view< _Value_type, _Rank > &  _Dest 
)

Copies the elements in the range [_SrcFirst, _SrcLast) into the destination array_view.

Parameters
_SrcFirstA beginning iterator into the source container.
_SrcLastAn ending iterator into the source container.
_DestThe destination array_view.
6401 {
6402  auto _Span_id = details::_Get_amp_trace()->_Start_copy_event_helper(nullptr,
6404  sizeof(_Value_type) * std::distance(_SrcFirst, _SrcLast));
6405 
6406  _Copy_async_impl(_SrcFirst, _SrcLast, _Dest)._Get();
6407 
6409 }
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename InputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( InputIterator  _SrcFirst,
const array_view< _Value_type, _Rank > &  _Dest 
)

Copies the contents of an STL container into the destination array_view.

Parameters
_SrcFirstA beginning iterator into the source container; if the number of available container elements starting at this iterator position is less than _Dest.extent.size(), undefined behavior results.
_DestThe destination array_view.
6422 {
6423  InputIterator _SrcLast = _SrcFirst;
6424  std::advance(_SrcLast, _Dest.extent.size());
6425  copy(_SrcFirst, _SrcLast, _Dest);
6426 }
_OutIt copy(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2369
void advance(_InIt &_Where, _Diff _Off)
Definition: xutility:1089
template<typename OutputIterator , typename _Value_type , int _Rank>
void Concurrency::copy ( const array_view< _Value_type, _Rank > &  _Src,
OutputIterator  _DestIter 
)

Copies the contents of the array_view into the destination beginning at _DestIter.

Parameters
_SrcThe source array_view.
_DestIterAn output iterator to the beginning position at destination.
6464 {
6465  _CPP_AMP_VERIFY_MUTABLE_ITERATOR(OutputIterator);
6466 
6468  nullptr,
6469  sizeof(_Value_type) * _Src.extent.size());
6470 
6471  _Copy_async_impl(_Src, _DestIter)._Get();
6472 
6474 }
_AMPIMP void _Get()
Wait until the _Event completes and throw any exceptions that occur.
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_AMPIMP ULONG _Start_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
#define _CPP_AMP_VERIFY_MUTABLE_ITERATOR(_Type_name)
Definition: xxamp.h:27
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
_AMPIMP void _Write_end_event(ULONG _Span_id)
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array< _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array into the destination array.

Parameters
_SrcThe source array.
_DestThe destination array.
Returns
A future upon which to wait for the operation to complete.
5989 {
5992  sizeof(_Value_type) * _Src.extent.size());
5993 
5994  auto _Ev = _Copy_async_impl(_Src, _Dest);
5995 
5996  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
5997 }
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
constexpr size_type size() const _NOEXCEPT
Definition: array:111
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3753
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( InputIterator  _SrcFirst,
InputIterator  _SrcLast,
array< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the elements in the range [_SrcFirst, _SrcLast) into the destination array.

Parameters
_SrcFirstA beginning iterator into the source container.
_SrcLastAn ending iterator into the source container.
_DestThe destination array.
Returns
A future upon which to wait for the operation to complete.
6035 {
6036  auto _Async_op_id = details::_Get_amp_trace()->_Launch_async_copy_event_helper(nullptr,
6038  sizeof(_Value_type) * std::distance(_SrcFirst, _SrcLast));
6039 
6040  _Event _Ev = _Copy_async_impl(_SrcFirst, _SrcLast, _Dest);
6041 
6042  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6043 }
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
Definition: amprt.h:318
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3753
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( InputIterator  _SrcFirst,
array< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the elements beginning at _SrcFirst into the destination array.

Parameters
_SrcFirstA beginning iterator into the source container; if the number of available container elements starting at this iterator position is less than _Dest.extent.size(), undefined behavior results.
_DestThe destination array.
Returns
A future upon which to wait for the operation to complete.
6082 {
6083  InputIterator _SrcLast = _SrcFirst;
6084  std::advance(_SrcLast, _Dest.extent.size());
6085  return copy_async(_SrcFirst, _SrcLast, _Dest);
6086 }
constexpr size_type size() const _NOEXCEPT
Definition: array:111
concurrency::completion_future copy_async(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Asynchronously copies the contents of the array_view into the destination beginning at _DestIter...
Definition: amp.h:6440
void advance(_InIt &_Where, _Diff _Off)
Definition: xutility:1089
template<typename OutputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array< _Value_type, _Rank > &  _Src,
OutputIterator  _DestIter 
)

Asynchronously copies the contents of the array into the destination beginning at _DestIter.

Parameters
_SrcThe source array.
_DestIterAn output iterator to the beginning position at destination.
Returns
A future upon which to wait for the operation to complete.
6118 {
6119  _CPP_AMP_VERIFY_MUTABLE_ITERATOR(OutputIterator);
6120 
6122  nullptr,
6123  sizeof(_Value_type) * _Src.extent.size());
6124  _Event _Ev = _Copy_async_impl(_Src, _DestIter);
6125 
6126  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6127 }
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
constexpr size_type size() const _NOEXCEPT
Definition: array:111
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
#define _CPP_AMP_VERIFY_MUTABLE_ITERATOR(_Type_name)
Definition: xxamp.h:27
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
Definition: amprt.h:318
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3753
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array< _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array into the destination array_view.

Parameters
_SrcThe source array.
_DestThe destination array_view.
Returns
A future upon which to wait for the operation to complete.
6164 {
6167  sizeof(_Value_type) * _Src.extent.size());
6168 
6169  _Event _Ev = _Copy_async_impl(_Src, _Dest);
6170 
6171  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6172 }
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
constexpr size_type size() const _NOEXCEPT
Definition: array:111
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
Definition: amprt.h:318
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3753
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array_view< const _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array_view into the destination array.

Parameters
_SrcThe source array_view.
_DestThe destination array.
Returns
A future upon which to wait for the operation to complete.
6207 {
6210  sizeof(_Value_type) * _Src.extent.size());
6211 
6212  _Event _Ev = _Copy_async_impl(_Src, _Dest);
6213 
6214  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6215 }
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
Definition: amprt.h:318
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3753
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array_view< _Value_type, _Rank > &  _Src,
array< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array_view into the destination array.

Parameters
_SrcThe source array_view.
_DestThe destination array.
Returns
A future upon which to wait for the operation to complete.
6250 {
6251  return copy_async<_Value_type, _Rank>(array_view<const _Value_type, _Rank>(_Src), _Dest);
6252 }
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array_view< const _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array_view into the destination array_view.

Parameters
_SrcThe source array_view.
_DestThe destination array_view.
Returns
A future upon which to wait for the operation to complete.
6281 {
6284  sizeof(_Value_type) * _Src.extent.size());
6285 
6286  _Event _Ev = _Copy_async_impl(_Src, _Dest);
6287 
6288  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6289 }
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
Definition: amprt.h:318
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3753
template<typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array_view< _Value_type, _Rank > &  _Src,
const array_view< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the contents of the source array_view into the destination array_view.

Parameters
_SrcThe source array_view.
_DestThe destination array_view.
Returns
A future upon which to wait for the operation to complete.
6324 {
6325  return copy_async<_Value_type, _Rank>(array_view<const _Value_type, _Rank>(_Src), _Dest);
6326 }
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( InputIterator  _SrcFirst,
InputIterator  _SrcLast,
const array_view< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the elements in the range [_SrcFirst, _SrcLast) into the destination array_view.

Parameters
_SrcFirstA beginning iterator into the source container.
_SrcLastAn ending iterator into the source container.
_DestThe destination array_view.
Returns
A future upon which to wait for the operation to complete.
6358 {
6359  auto _Async_op_id = details::_Get_amp_trace()->_Launch_async_copy_event_helper(nullptr,
6361  sizeof(_Value_type) * std::distance(_SrcFirst, _SrcLast));
6362 
6363  _Event _Ev = _Copy_async_impl(_SrcFirst, _SrcLast, _Dest);
6364 
6365  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6366 }
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
Definition: amprt.h:318
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3753
template<typename InputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( InputIterator  _SrcFirst,
const array_view< _Value_type, _Rank > &  _Dest 
)

Asynchronously copies the elements beginning at _SrcFirst into the destination array_view.

Parameters
_SrcFirstA beginning iterator into the source container; if the number of available container elements starting at this iterator position is less than _Dest.extent.size(), undefined behavior results.
_DestThe destination array_view.
Returns
A future upon which to wait for the operation to complete.
6382 {
6383  InputIterator _SrcLast = _SrcFirst;
6384  std::advance(_SrcLast, _Dest.extent.size());
6385  return copy_async(_SrcFirst, _SrcLast, _Dest);
6386 }
concurrency::completion_future copy_async(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Asynchronously copies the contents of the array_view into the destination beginning at _DestIter...
Definition: amp.h:6440
void advance(_InIt &_Where, _Diff _Off)
Definition: xutility:1089
template<typename OutputIterator , typename _Value_type , int _Rank>
concurrency::completion_future Concurrency::copy_async ( const array_view< _Value_type, _Rank > &  _Src,
OutputIterator  _DestIter 
)

Asynchronously copies the contents of the array_view into the destination beginning at _DestIter.

Parameters
_SrcThe source array_view.
_DestIterAn output iterator to the beginning position at destination.
Returns
A future upon which to wait for the operation to complete.
6441 {
6442  _CPP_AMP_VERIFY_MUTABLE_ITERATOR(OutputIterator);
6443 
6444  // Caller is responsible for passing valid _DestIter
6446  nullptr,
6447  sizeof(_Value_type) * _Src.extent.size());
6448 
6449  _Event _Ev = _Copy_async_impl(_Src, _DestIter);
6450 
6451  return details::_Get_amp_trace()->_Start_async_op_wait_event_helper(_Async_op_id, _Ev);
6452 }
_AMPIMP _Ret_ _Amp_runtime_trace *__cdecl _Get_amp_trace()
_AMPIMP ULONG _Launch_async_copy_event_helper(const _Buffer_descriptor &_Src, const _Buffer_descriptor &_Dest, ULONGLONG _Num_bytes_for_copy)
const _Buffer_descriptor & _Get_buffer_descriptor(const _Array_type &_Array) __GPU
Definition: xxamp.h:1063
#define _CPP_AMP_VERIFY_MUTABLE_ITERATOR(_Type_name)
Definition: xxamp.h:27
_Event _Copy_async_impl(const array_view< _Value_type, _Rank > &_Src, OutputIterator _DestIter)
Definition: amp.h:5933
Definition: amprt.h:318
concurrency::completion_future _Start_async_op_wait_event_helper(ULONG _Async_op_id, _Event _Ev)
Definition: amprt.h:3753
void Concurrency::direct3d_abort ( )
void Concurrency::direct3d_errorf ( const char *  ,
  ... 
)
void Concurrency::direct3d_printf ( const char *  ,
  ... 
)
_CONCRTIMP void __cdecl Concurrency::Free ( _Pre_maybenull_ _Post_invalid_ void _PAllocation)

Releases a block of memory previously allocated by the Alloc method to the Concurrency Runtime Caching Suballocator.

Parameters
_PAllocationA pointer to memory previously allocated by the Alloc method which is to be freed. If the parameter _PAllocation is set to the value NULL, this method will ignore it and return immediately.

For more information about which scenarios in your application could benefit from using the Caching Suballocator, see Task Scheduler (Concurrency Runtime).

See also
Concurrency::Alloc Function
const ::std::shared_ptr<scheduler_interface>& Concurrency::get_ambient_scheduler ( )
inline
89 {
91 }
inline::std::shared_ptr< scheduler_interface > & _GetStaticAmbientSchedulerRef()
Definition: pplwin.h:80
void Concurrency::global_memory_fence ( const tile_barrier &  _Barrier)
inline

Ensures that global memory accesses are visible to other threads in the thread tile, and are executed according to program order

Parameters
_BarrierA tile_barrier object
7190 {
7192 }
void __dp_d3d_device_memory_fence() __GPU_ONLY
void Concurrency::interruption_point ( )
inline

Creates an interruption point for cancellation. If a cancellation is in progress in the context where this function is called, this will throw an internal exception that aborts the execution of the currently executing parallel work. If cancellation is not in progress, the function does nothing.

You should not catch the internal cancellation exception thrown by the interruption_point() function. The exception will be caught and handled by the runtime, and catching it may cause your program to behave abnormally.

881 {
882  structured_task_group _Stg;
883  _Stg.wait();
884 }
_CONCRTIMP bool __cdecl Concurrency::is_current_task_group_canceling ( )

Returns an indication of whether the task group which is currently executing inline on the current context is in the midst of an active cancellation (or will be shortly). Note that if there is no task group currently executing inline on the current context, false will be returned.

Returns
true if the task group which is currently executing is canceling, false otherwise.

For more information, see Cancellation in the PPL.

See also
task_group Class, structured_task_group Class
template<typename _Type1 , typename _Type2 , typename... _Types>
choice<std::tuple<_Type1, _Type2, _Types...> > Concurrency::make_choice ( _Type1  _Item1,
_Type2  _Item2,
_Types...  _Items 
)

Constructs a choice messaging block from an optional Scheduler or ScheduleGroup and two or more input sources.

Template Parameters
_Type1The message block type of the first source.
_Type2The message block type of the second source.
_TypesThe message block types of additional sources.
Parameters
_Item1The first source.
_Item2The second source.
_ItemsAdditional sources.
Returns
A choice message block with two or more input sources.
See also
choice Class
11968 {
11969  return choice<std::tuple<_Type1, _Type2, _Types...>>(std::make_tuple(_Item1, _Item2, _Items...));
11970 }
constexpr tuple< typename _Unrefwrap< _Types >::type...> make_tuple(_Types &&..._Args)
Definition: tuple:965
template<typename _Type1 , typename _Type2 , typename... _Types>
multitype_join<std::tuple<_Type1, _Type2, _Types...>, greedy> Concurrency::make_greedy_join ( _Type1  _Item1,
_Type2  _Item2,
_Types...  _Items 
)

Constructs a greedy multitype_join messaging block from an optional Scheduler or ScheduleGroup and two or more input sources.

Template Parameters
_Type1The message block type of the first source.
_Type2The message block type of the second source.
_TypesThe message block types of additional sources.
Parameters
_Item1The first source.
_Item2The second source.
_ItemsAdditional sources.
Returns
A greedy multitype_join message block with two or more input sources.
See also
multitype_join Class
13222 {
13223  return multitype_join<std::tuple<_Type1, _Type2, _Types...>, greedy>(std::make_tuple(_Item1, _Item2, _Items...));
13224 }
constexpr tuple< typename _Unrefwrap< _Types >::type...> make_tuple(_Types &&..._Args)
Definition: tuple:965
Greedy join messaging blocks immediately accept a message upon propagation. This is more efficient...
Definition: agents.h:9124
template<typename _Type1 , typename _Type2 , typename... _Types>
multitype_join<std::tuple<_Type1, _Type2, _Types...> > Concurrency::make_join ( _Type1  _Item1,
_Type2  _Item2,
_Types...  _Items 
)

Constructs a non_greedy multitype_join messaging block from an optional Scheduler or ScheduleGroup and two or more input sources.

Template Parameters
_Type1The message block type of the first source.
_Type2The message block type of the second source.
_TypesThe message block types of additional sources.
Parameters
_Item1The first source.
_Item2The second source.
_ItemsAdditional sources.
Returns
A non_greedy multitype_join message block with two or more input sources.
See also
multitype_join Class
13106 {
13107  return multitype_join<std::tuple<_Type1, _Type2, _Types...>>(std::make_tuple(_Item1, _Item2, _Items...));
13108 }
constexpr tuple< typename _Unrefwrap< _Types >::type...> make_tuple(_Types &&..._Args)
Definition: tuple:965
template<class _Function >
task_handle<_Function> Concurrency::make_task ( const _Function &  _Func)

A factory method for creating a task_handle object.

Template Parameters
_FunctionThe type of the function object that will be invoked to execute the work represented by the task_handle object.
Parameters
_FuncThe function that will be invoked to execute the work represented by the task_handle object. This may be a lambda functor, a pointer to a function, or any object that supports a version of the function call operator with the signature void operator()().
Returns
A task_handle object.

This function is useful when you need to create a task_handle object with a lambda expression, because it allows you to create the object without knowing the true type of the lambda functor.

See also
task_handle Class, task_group Class, structured_task_group Class
166 {
167  return task_handle<_Function>(_Func);
168 }
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, bool>::type Concurrency::operator!= ( const _Tuple_type< _Rank > &  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
830 {
831  return !details::_cmp_op_loop_helper<_Tuple_type<_Rank>, details::opEq>::func(_Lhs, _Rhs);
832 }
Definition: xxamp.h:228
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator!= ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is not equal to the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vectors are not equal; false if the concurrent vectors are equal.

Two concurrent vectors are equal if they have the same number of elements and their respective elements have the same values. Otherwise, they are unequal.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1775 {
1776  return !(_A == _B);
1777 }
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator% ( const _Tuple_type< _Rank > &  _Lhs,
typename _Tuple_type< _Rank >::value_type  _Rhs 
)
927 {
928  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
929  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opMod>::func(new_Tuple, _Lhs, _Rhs);
930  return new_Tuple;
931 }
Definition: xxamp.h:244
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator% ( typename _Tuple_type< _Rank >::value_type  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
936 {
937  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
938  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opMod>::func(new_Tuple, _Lhs, _Rhs);
939  return new_Tuple;
940 }
Definition: xxamp.h:244
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator* ( const _Tuple_type< _Rank > &  _Lhs,
typename _Tuple_type< _Rank >::value_type  _Rhs 
)
891 {
892  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
893  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opMul>::func(new_Tuple, _Lhs, _Rhs);
894  return new_Tuple;
895 }
Definition: xxamp.h:242
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator* ( typename _Tuple_type< _Rank >::value_type  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
900 {
901  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
902  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opMul>::func(new_Tuple, _Lhs, _Rhs);
903  return new_Tuple;
904 }
Definition: xxamp.h:242
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator+ ( const _Tuple_type< _Rank > &  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
837 {
838  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
839  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opAdd>::func(new_Tuple, _Lhs, _Rhs);
840  return new_Tuple;
841 }
Definition: xxamp.h:240
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator+ ( const _Tuple_type< _Rank > &  _Lhs,
typename _Tuple_type< _Rank >::value_type  _Rhs 
)
855 {
856  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
857  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opAdd>::func(new_Tuple, _Lhs, _Rhs);
858  return new_Tuple;
859 }
Definition: xxamp.h:240
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator+ ( typename _Tuple_type< _Rank >::value_type  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
864 {
865  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
866  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opAdd>::func(new_Tuple, _Lhs, _Rhs);
867  return new_Tuple;
868 }
Definition: xxamp.h:240
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator- ( const _Tuple_type< _Rank > &  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
846 {
847  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
848  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opSub>::func(new_Tuple, _Lhs, _Rhs);
849  return new_Tuple;
850 }
Definition: xxamp.h:241
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator- ( const _Tuple_type< _Rank > &  _Lhs,
typename _Tuple_type< _Rank >::value_type  _Rhs 
)
873 {
874  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
875  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opSub>::func(new_Tuple, _Lhs, _Rhs);
876  return new_Tuple;
877 }
Definition: xxamp.h:241
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator- ( typename _Tuple_type< _Rank >::value_type  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
882 {
883  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
884  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opSub>::func(new_Tuple, _Lhs, _Rhs);
885  return new_Tuple;
886 }
Definition: xxamp.h:241
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator/ ( const _Tuple_type< _Rank > &  _Lhs,
typename _Tuple_type< _Rank >::value_type  _Rhs 
)
909 {
910  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
911  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opDiv>::func(new_Tuple, _Lhs, _Rhs);
912  return new_Tuple;
913 }
Definition: xxamp.h:243
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, _Tuple_type<_Rank> >::type Concurrency::operator/ ( typename _Tuple_type< _Rank >::value_type  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
918 {
919  _Tuple_type<_Rank> new_Tuple = details::_Create_uninitialized_tuple<_Tuple_type<_Rank>>();
920  details::_arithmetic_op_loop_helper<_Tuple_type<_Rank>, opDiv>::func(new_Tuple, _Lhs, _Rhs);
921  return new_Tuple;
922 }
Definition: xxamp.h:243
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator< ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is less than the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vector on the left side of the operator is less than the concurrent vector on the right side of the operator; otherwise false.

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1813 {
1814  return (std::lexicographical_compare(_A.begin(), _A.end(), _B.begin(), _B.end()));
1815 }
bool lexicographical_compare(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2)
Definition: memory:830
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator<= ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is less than or equal to the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vector on the left side of the operator is less than or equal to the concurrent vector on the right side of the operator; otherwise false.

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1889 {
1890  return !(_B < _A);
1891 }
template<int _Rank, template< int > class _Tuple_type>
std::enable_if<details::_Is_extent_or_index<_Tuple_type<_Rank> >::value, bool>::type Concurrency::operator== ( const _Tuple_type< _Rank > &  _Lhs,
const _Tuple_type< _Rank > &  _Rhs 
)
823 {
824  return details::_cmp_op_loop_helper<_Tuple_type<_Rank>, details::opEq>::func(_Lhs, _Rhs);
825 }
Definition: xxamp.h:228
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator== ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is equal to the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vector on the left side of the operator is equal to the concurrent vector on the right side of the operator; otherwise false.

Two concurrent vectors are equal if they have the same number of elements and their respective elements have the same values. Otherwise, they are unequal.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1728 {
1729  // Simply: return _A.size() == _B.size() && std::equal(_A.begin(), _A.end(), _B.begin());
1730  if(_A.size() != _B.size())
1731  return false;
1732  typename concurrent_vector<_Ty, A1>::const_iterator _I(_A.begin());
1733  typename concurrent_vector<_Ty, A2>::const_iterator _J(_B.begin());
1734  for(; _I != _A.end(); ++_I, ++_J)
1735  {
1736  if( !(*_I == *_J) )
1737  return false;
1738  }
1739  return true;
1740 }
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator> ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is greater than the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vector on the left side of the operator is greater than the concurrent vector on the right side of the operator; otherwise false.

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1851 {
1852  return _B < _A;
1853 }
template<typename _Ty , class A1 , class A2 >
bool Concurrency::operator>= ( const concurrent_vector< _Ty, A1 > &  _A,
const concurrent_vector< _Ty, A2 > &  _B 
)
inline

Tests if the concurrent_vector object on the left side of the operator is greater than or equal to the concurrent_vector object on the right side.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
A1The allocator type of the first concurrent_vector object.
A2The allocator type of the second concurrent_vector object.
Parameters
_AAn object of type concurrent_vector.
_BAn object of type concurrent_vector.
Returns
true if the concurrent vector on the left side of the operator is greater than or equal to the concurrent vector on the right side of the operator; otherwise false.

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B .

See also
concurrent_vector Class, Parallel Containers and Objects
1927 {
1928  return !(_A < _B);
1929 }
template<typename _Allocator , typename _Random_iterator , typename _Function >
void Concurrency::parallel_buffered_sort ( const _Allocator &  _Alloc,
const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Func,
const size_t  _Chunk_size = 2048 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the binary comparator.
Parameters
_AllocAn instance of an STL compatible memory allocator.
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_FuncA user-defined predicate function object that defines the comparison criterion to be satisfied by successive elements in the ordering. A binary predicate takes two arguments and returns true when satisfied and false when not satisfied. This comparator function must impose a strict weak ordering on pairs of elements from the sequence.
_Chunk_sizeThe minimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5362 {
5363  _CONCRT_ASSERT(_Chunk_size > 0);
5364 
5365  // Check cancellation before the algorithm starts.
5367 
5368  size_t _Size = _End - _Begin;
5370 
5371  if (_Size <= _Chunk_size || _Core_num < 2)
5372  {
5373  return std::sort(_Begin, _End, _Func);
5374  }
5375  const static size_t _CORE_NUM_MASK = 0x55555555;
5376 
5377  _AllocatedBufferHolder<_Allocator> _Holder(_Size, _Alloc);
5378 
5379  // Prevent cancellation from happening during the algorithm in case it leaves buffers in unknown state.
5381  // This buffered sort algorithm will divide chunks and apply parallel quicksort on each chunk. In the end, it will
5382  // apply parallel merge to these sorted chunks.
5383  //
5384  // We need to decide on the number of chunks to divide the input buffer into. If we divide it into n chunks, log(n)
5385  // merges will be needed to get the final sorted result. In this algorithm, we have two buffers for each merge
5386  // operation, let's say buffer A and B. Buffer A is the original input array, buffer B is the additional allocated
5387  // buffer. Each turn's merge will put the merge result into the other buffer; for example, if we decided to split
5388  // into 8 chunks in buffer A at very beginning, after one pass of merging, there will be 4 chunks in buffer B.
5389  // If we apply one more pass of merging, there will be 2 chunks in buffer A again.
5390  //
5391  // The problem is we want to the final merge pass to put the result back in buffer A, so that we don't need
5392  // one extra copy to put the sorted data back to buffer A.
5393  // To make sure the final result is in buffer A (original input array), we need an even number of merge passes,
5394  // which means log(n) must be an even number. Thus n must be a number power(2, even number). For example, when the
5395  // even number is 2, n is power(2, 2) = 4, when even number is 4, n is power(2, 4) = 16. When we divide chunks
5396  // into these numbers, the final merge result will be in the original input array. Now we need to decide the chunk(split)
5397  // number based on this property and the number of cores.
5398  //
5399  // We want to get a chunk (split) number close to the core number (or a little more than the number of cores),
5400  // and it also needs to satisfy above property. For a 8 core machine, the best chunk number should be 16, because it's
5401  // the smallest number that satisfies the above property and is bigger than the core number (so that we can utilize all
5402  // cores, a little more than core number is OK, we need to split more tasks anyway).
5403  //
5404  // In this algorithm, we will make this alignment by bit operations (it's easy and clear). For a binary representation,
5405  // all the numbers that satisfy power(2, even number) will be 1, 100, 10000, 1000000, 100000000 ...
5406  // After OR-ing these numbers together, we will get a mask (... 0101 0101 0101) which is all possible combinations of
5407  // power(2, even number). We use _Core_num & _CORE_NUM_MASK | _Core_num << 1 & _CORE_NUM_MASK, a bit-wise operation to align
5408  // _Core_num's highest bit into a power(2, even number).
5409  //
5410  // It means if _Core_num = 8, the highest bit in binary is bin(1000) which is not power(2, even number). After this
5411  // bit-wise operation, it will align to bin(10000) = 16 which is power(2, even number). If the _Core_num = 16, after
5412  // alignment it still returns 16. The trick is to make sure the highest bit of _Core_num will align to the "1" bit of the
5413  // mask bin(... 0101 0101 0101) We don't care about the other bits on the aligned result except the highest bit, because they
5414  // will be ignored in the function.
5415  _Parallel_buffered_sort_impl(_Begin, _Size, stdext::make_unchecked_array_iterator(_Holder._Get_buffer()),
5416  _Func, _Core_num & _CORE_NUM_MASK | _Core_num << 1 & _CORE_NUM_MASK, _Chunk_size);
5417  }, cancellation_token::none());
5418 
5419 }
unchecked_array_iterator< _Iterator > make_unchecked_array_iterator(_Iterator _Ptr)
Definition: iterator:725
void run_with_cancellation_token(const _Function &_Func, cancellation_token _Ct)
Executes a function object immediately and synchronously in the context of a given cancellation token...
Definition: ppl.h:865
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
void interruption_point()
Creates an interruption point for cancellation. If a cancellation is in progress in the context where...
Definition: ppl.h:880
bool _Parallel_buffered_sort_impl(const _Random_iterator &_Begin, size_t _Size, _Random_buffer_iterator _Output, const _Function &_Func, int _Div_num, const size_t _Chunk_size)
Definition: ppl.h:5104
static _CONCRTIMP unsigned int __cdecl _GetNumberOfVirtualProcessors()
_Size
Definition: vcruntime_string.h:36
void sort(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2781
template<typename _Allocator , typename _Random_iterator , typename _Function >
void Concurrency::parallel_buffered_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Func,
const size_t  _Chunk_size = 2048 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the binary comparator.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_FuncA user-defined predicate function object that defines the comparison criterion to be satisfied by successive elements in the ordering. A binary predicate takes two arguments and returns true when satisfied and false when not satisfied. This comparator function must impose a strict weak ordering on pairs of elements from the sequence.
_Chunk_sizeThe minimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5463 {
5464  _Allocator _Alloc;
5465  return parallel_buffered_sort<_Allocator, _Random_iterator, _Function>(_Alloc, _Begin, _End, _Func, _Chunk_size);
5466 }
template<typename _Random_iterator , typename _Function >
void Concurrency::parallel_buffered_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Func,
const size_t  _Chunk_size = 2048 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the binary comparator.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_FuncA user-defined predicate function object that defines the comparison criterion to be satisfied by successive elements in the ordering. A binary predicate takes two arguments and returns true when satisfied and false when not satisfied. This comparator function must impose a strict weak ordering on pairs of elements from the sequence.
_Chunk_sizeThe minimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5507 {
5508  parallel_buffered_sort<std::allocator<typename std::iterator_traits<_Random_iterator>::value_type>>(_Begin, _End, _Func, _Chunk_size);
5509 }
template<typename _Random_iterator >
void Concurrency::parallel_buffered_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_Random_iteratorThe iterator type of the input range.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5539 {
5540  parallel_buffered_sort<std::allocator<typename std::iterator_traits<_Random_iterator>::value_type>>(_Begin, _End,
5541  std::less<typename std::iterator_traits<_Random_iterator>::value_type>());
5542 }
template<typename _Allocator , typename _Random_iterator >
void Concurrency::parallel_buffered_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5575 {
5576  parallel_buffered_sort<_Allocator>(_Begin, _End,
5577  std::less<typename std::iterator_traits<_Random_iterator>::value_type>());
5578 }
template<typename _Allocator , typename _Random_iterator >
void Concurrency::parallel_buffered_sort ( const _Allocator &  _Alloc,
const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort except that it needs O(n) additional space, and requires default initialization for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
Parameters
_AllocAn instance of an STL compatible memory allocator.
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. In most cases parallel_buffered_sort will show an improvement in performance over parallel_sort, and you should use it over parallel_sort if you have the memory available.

If you do not supply a binary comparator std::less is used as the default, which requires the element type to provide the operator operator<().

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5614 {
5615  parallel_buffered_sort<_Allocator>(_Alloc, _Begin, _End, std::less<typename std::iterator_traits<_Random_iterator>::value_type>());
5616 }
template<typename _Index_type , typename _Function , typename _Partitioner >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
_Index_type  _Step,
const _Function &  _Func,
_Partitioner &&  _Part 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration.
_FunctionThe type of the function that will be executed at each iteration.
_PartitionerThe type of the partitioner that is used to partition the supplied range.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_StepThe value by which to step when iterating from _First to _Last . The step must be positive. invalid_argument is thrown if the step is less than 1.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

For more information, see Parallel Algorithms.

2556 {
2558  _Parallel_for_impl(_First, _Last, _Step, _Func, std::forward<_Partitioner>(_Part));
2560 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:38
_CONCRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
_CONCRTIMP const GUID PPLParallelForEventGuid
A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to u...
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
void _Parallel_for_impl(_Index_type _First, _Index_type _Last, _Index_type _Step, const _Function &_Func)
Definition: ppl.h:2509
_FwdIt _Last
Definition: algorithm:1936
template<typename _Index_type , typename _Function >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
_Index_type  _Step,
const _Function &  _Func 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration. _Index_type must be an integral type.
_FunctionThe type of the function that will be executed at each iteration.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_StepThe value by which to step when iterating from _First to _Last . The step must be positive. invalid_argument is thrown if the step is less than 1.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).

For more information, see Parallel Algorithms.

2592 {
2593  parallel_for(_First, _Last, _Step, _Func, auto_partitioner());
2594 }
_FwdIt _Last
Definition: algorithm:1936
void parallel_for(_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2747
template<typename _Index_type , typename _Function >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
const _Function &  _Func,
const auto_partitioner &  _Part = auto_partitioner() 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration.
_FunctionThe type of the function that will be executed at each iteration.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

For more information, see Parallel Algorithms.

2631 {
2632  parallel_for(_First, _Last, _Index_type(1), _Func, _Part);
2633 }
_FwdIt _Last
Definition: algorithm:1936
void parallel_for(_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2747
template<typename _Index_type , typename _Function >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
const _Function &  _Func,
const static_partitioner &  _Part 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration.
_FunctionThe type of the function that will be executed at each iteration.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

For more information, see Parallel Algorithms.

2670 {
2671  parallel_for(_First, _Last, _Index_type(1), _Func, _Part);
2672 }
_FwdIt _Last
Definition: algorithm:1936
void parallel_for(_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2747
template<typename _Index_type , typename _Function >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
const _Function &  _Func,
const simple_partitioner &  _Part 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration.
_FunctionThe type of the function that will be executed at each iteration.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

For more information, see Parallel Algorithms.

2709 {
2710  parallel_for(_First, _Last, _Index_type(1), _Func, _Part);
2711 }
_FwdIt _Last
Definition: algorithm:1936
void parallel_for(_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2747
template<typename _Index_type , typename _Function >
void Concurrency::parallel_for ( _Index_type  _First,
_Index_type  _Last,
const _Function &  _Func,
affinity_partitioner &  _Part 
)

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

Template Parameters
_Index_typeThe type of the index being used for the iteration.
_FunctionThe type of the function that will be executed at each iteration.
Parameters
_FirstThe first index to be included in the iteration.
_LastThe index one past the last index to be included in the iteration.
_FuncThe function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type ).
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

For more information, see Parallel Algorithms.

2748 {
2749  parallel_for(_First, _Last, _Index_type(1), _Func, _Part);
2750 }
_FwdIt _Last
Definition: algorithm:1936
void parallel_for(_Index_type _First, _Index_type _Last, const _Function &_Func, affinity_partitioner &_Part)
parallel_for iterates over a range of indices and executes a user-supplied function at each iteration...
Definition: ppl.h:2747
template<typename _Iterator , typename _Function >
void Concurrency::parallel_for_each ( _Iterator  _First,
_Iterator  _Last,
const _Function &  _Func 
)

parallel_for_each applies a specified function to each element within a range, in parallel. It is semantically equivalent to the for_each function in the std namespace, except that iteration over the elements is performed in parallel, and the order of iteration is unspecified. The argument _Func must support a function call operator of the form operator()(T) where the parameter T is the item type of the container being iterated over.

Template Parameters
_IteratorThe type of the iterator being used to iterate over the container.
_FunctionThe type of the function that will be applied to each element within the range.
Parameters
_FirstAn iterator addressing the position of the first element to be included in parallel iteration.
_LastAn iterator addressing the position one past the final element to be included in parallel iteration.
_FuncA user-defined function object that is applied to each element in the range.

auto_partitioner

will be used for the overload without an explicit partitioner.

For iterators that do not support random access, only auto_partitioner

is supported.

For more information, see Parallel Algorithms.

2942 {
2943  parallel_for_each(_First, _Last, _Func, auto_partitioner());
2944 }
void parallel_for_each(_Iterator _First, _Iterator _Last, const _Function &_Func, _Partitioner &&_Part)
parallel_for_each applies a specified function to each element within a range, in parallel...
Definition: ppl.h:2984
_FwdIt _Last
Definition: algorithm:1936
template<typename _Iterator , typename _Function , typename _Partitioner >
void Concurrency::parallel_for_each ( _Iterator  _First,
_Iterator  _Last,
const _Function &  _Func,
_Partitioner &&  _Part 
)

parallel_for_each applies a specified function to each element within a range, in parallel. It is semantically equivalent to the for_each function in the std namespace, except that iteration over the elements is performed in parallel, and the order of iteration is unspecified. The argument _Func must support a function call operator of the form operator()(T) where the parameter T is the item type of the container being iterated over.

Template Parameters
_IteratorThe type of the iterator being used to iterate over the container.
_FunctionThe type of the function that will be applied to each element within the range.
Parameters
_FirstAn iterator addressing the position of the first element to be included in parallel iteration.
_LastAn iterator addressing the position one past the final element to be included in parallel iteration.
_FuncA user-defined function object that is applied to each element in the range.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.

auto_partitioner

will be used for the overload without an explicit partitioner.

For iterators that do not support random access, only auto_partitioner

is supported.

For more information, see Parallel Algorithms.

2985 {
2987  _Parallel_for_each_impl(_First, _Last, _Func, std::forward<_Partitioner>(_Part), typename std::iterator_traits<_Iterator>::iterator_category());
2989 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:38
_CONCRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
_CONCRTIMP const GUID PPLParallelForeachEventGuid
A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to u...
void _Parallel_for_each_impl(const _Random_iterator &_First, const _Random_iterator &_Last, const _Function &_Func, _Partitioner &&_Part, std::random_access_iterator_tag)
Definition: ppl.h:2888
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
_FwdIt _Last
Definition: algorithm:1936
template<int _Rank, typename _Kernel_type >
void Concurrency::parallel_for_each ( const extent< _Rank > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain on an accelerator_view. The accelerator_view is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator_view can be derived, the default is chosen.

Parameters
_Compute_domainAn extent which represents the set of indices that form the compute domain.
_KernelA function object that takes an argument of type "index&lt;_Rank&gt;" which performs the parallel computation.
7021 {
7022  _Host_Scheduling_info _SchedulingInfo = {accelerator::get_auto_selection_view()};
7023  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7024 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, int _Dim1, int _Dim2, typename _Kernel_type >
void Concurrency::parallel_for_each ( const tiled_extent< _Dim0, _Dim1, _Dim2 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 3-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen.

Parameters
_Compute_domainA tiled_extent<_Dim0,_Dim1,_Dim2> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0,_Dim1,_Dim2&gt;" which performs the parallel computation.
7038 {
7039  _Host_Scheduling_info _SchedulingInfo = {accelerator::get_auto_selection_view()};
7040  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7041 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, int _Dim1, typename _Kernel_type >
void Concurrency::parallel_for_each ( const tiled_extent< _Dim0, _Dim1 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 2-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen.

Parameters
_Compute_domainA tiled_extent<_Dim0,_Dim1> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0,_Dim1&gt;" which performs the parallel computation.
7055 {
7056  _Host_Scheduling_info _SchedulingInfo = {accelerator::get_auto_selection_view()};
7057  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7058 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, typename _Kernel_type >
void Concurrency::parallel_for_each ( const tiled_extent< _Dim0 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 1-dimensional regions. The accelerator is determined from the arrays and/or array_views captured by the kernel function, or if no accelerator can be derived, the default is chosen.

Parameters
_Compute_domainA tiled_extent<_Dim0> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0&gt;" which performs the parallel computation.
7072 {
7073  _Host_Scheduling_info _SchedulingInfo = {accelerator::get_auto_selection_view()};
7074  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7075 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Rank, typename _Kernel_type >
void Concurrency::parallel_for_each ( const accelerator_view &  _Accl_view,
const extent< _Rank > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain on an accelerator.

Parameters
_Accl_viewThe accelerator_view upon which to run this parallel computation.
_Compute_domainAn extent which represents the set of indices that form the compute domain.
_KernelA function object that takes an argument of type "index&lt;_Rank&gt;" which performs the parallel computation.
7090 {
7091  _Host_Scheduling_info _SchedulingInfo = {_Accl_view};
7092  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7093 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, int _Dim1, int _Dim2, typename _Kernel_type >
void Concurrency::parallel_for_each ( const accelerator_view &  _Accl_view,
const tiled_extent< _Dim0, _Dim1, _Dim2 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 3-dimensional regions.

Parameters
_Accl_viewThe accelerator_view upon which to run this parallel computation.
_Compute_domainA tiled_extent<_Dim0,_Dim1,_Dim2> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0,_Dim1,_Dim2&gt;" which performs the parallel computation.
7109 {
7110  _Host_Scheduling_info _SchedulingInfo = {_Accl_view};
7111  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7112 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, int _Dim1, typename _Kernel_type >
void Concurrency::parallel_for_each ( const accelerator_view &  _Accl_view,
const tiled_extent< _Dim0, _Dim1 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 2-dimensional regions.

Parameters
_Accl_viewThe accelerator_view upon which to run this parallel computation.
_Compute_domainA tiled_extent<_Dim0,_Dim1> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0,_Dim1&gt;" which performs the parallel computation.
7128 {
7129  _Host_Scheduling_info _SchedulingInfo = {_Accl_view};
7130  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7131 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<int _Dim0, typename _Kernel_type >
void Concurrency::parallel_for_each ( const accelerator_view &  _Accl_view,
const tiled_extent< _Dim0 > &  _Compute_domain,
const _Kernel_type &  _Kernel 
)

Invokes a parallel computation of a kernel function over a compute domain that has been tiled into 1-dimensional regions.

Parameters
_Accl_viewThe accelerator_view upon which to run this parallel computation.
_Compute_domainA tiled_extent<_Dim0> which represents the tiled set of indices that form the compute domain.
_KernelA function object that takes an argument of type "tiled_index&lt;_Dim0&gt;" which performs the parallel computation.
7147 {
7148  _Host_Scheduling_info _SchedulingInfo = {_Accl_view};
7149  details::_Parallel_for_each(&_SchedulingInfo, _Compute_domain, _Kernel);
7150 }
void _Parallel_for_each(_In_ _Host_Scheduling_info *_Sch_info, extent< _Rank > _Compute_domain, const _Kernel_type &_F)
template<typename _Function1 , typename _Function2 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

946 {
948 
949  _Parallel_invoke_impl(_Func1, _Func2);
950 
952 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:38
_CONCRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
_CONCRTIMP const GUID PPLParallelInvokeEventGuid
A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to u...
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
void _Parallel_invoke_impl(const _Function1 &_Func1, const _Function2 &_Func2)
Definition: ppl.h:908
template<typename _Function1 , typename _Function2 , typename _Function3 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

986 {
988 
989  structured_task_group _Task_group;
990 
991  task_handle<_Function1> _Task_handle1(_Func1);
992  _Task_group.run(_Task_handle1);
993 
994  task_handle<_Function2> _Task_handle2(_Func2);
995  _Task_group.run(_Task_handle2);
996 
997  task_handle<_Function3> _Task_handle3(_Func3);
998  _Task_group.run_and_wait(_Task_handle3);
999 
1001 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:38
_CONCRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
_CONCRTIMP const GUID PPLParallelInvokeEventGuid
A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to u...
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1041 {
1043 
1044  structured_task_group _Task_group;
1045 
1046  task_handle<_Function1> _Task_handle1(_Func1);
1047  _Task_group.run(_Task_handle1);
1048 
1049  task_handle<_Function2> _Task_handle2(_Func2);
1050  _Task_group.run(_Task_handle2);
1051 
1052  task_handle<_Function3> _Task_handle3(_Func3);
1053  _Task_group.run(_Task_handle3);
1054 
1055  task_handle<_Function4> _Task_handle4(_Func4);
1056  _Task_group.run_and_wait(_Task_handle4);
1057 
1059 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:38
_CONCRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
_CONCRTIMP const GUID PPLParallelInvokeEventGuid
A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to u...
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1105 {
1107 
1108  structured_task_group _Task_group;
1109 
1110  task_handle<_Function1> _Task_handle1(_Func1);
1111  _Task_group.run(_Task_handle1);
1112 
1113  task_handle<_Function2> _Task_handle2(_Func2);
1114  _Task_group.run(_Task_handle2);
1115 
1116  task_handle<_Function3> _Task_handle3(_Func3);
1117  _Task_group.run(_Task_handle3);
1118 
1119  task_handle<_Function4> _Task_handle4(_Func4);
1120  _Task_group.run(_Task_handle4);
1121 
1122  task_handle<_Function5> _Task_handle5(_Func5);
1123  _Task_group.run_and_wait(_Task_handle5);
1124 
1126 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:38
_CONCRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
_CONCRTIMP const GUID PPLParallelInvokeEventGuid
A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to u...
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5,
const _Function6 &  _Func6 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
_Function6The type of the sixth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.
_Func6The sixth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1180 {
1182 
1183  structured_task_group _Task_group;
1184 
1185  task_handle<_Function1> _Task_handle1(_Func1);
1186  _Task_group.run(_Task_handle1);
1187 
1188  task_handle<_Function2> _Task_handle2(_Func2);
1189  _Task_group.run(_Task_handle2);
1190 
1191  task_handle<_Function3> _Task_handle3(_Func3);
1192  _Task_group.run(_Task_handle3);
1193 
1194  task_handle<_Function4> _Task_handle4(_Func4);
1195  _Task_group.run(_Task_handle4);
1196 
1197  task_handle<_Function5> _Task_handle5(_Func5);
1198  _Task_group.run(_Task_handle5);
1199 
1200  task_handle<_Function6> _Task_handle6(_Func6);
1201  _Task_group.run_and_wait(_Task_handle6);
1202 
1204 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:38
_CONCRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
_CONCRTIMP const GUID PPLParallelInvokeEventGuid
A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to u...
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5,
const _Function6 &  _Func6,
const _Function7 &  _Func7 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
_Function6The type of the sixth function object to be executed in parallel.
_Function7The type of the seventh function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.
_Func6The sixth function object to be executed in parallel.
_Func7The seventh function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1264 {
1266 
1267  structured_task_group _Task_group;
1268 
1269  task_handle<_Function1> _Task_handle1(_Func1);
1270  _Task_group.run(_Task_handle1);
1271 
1272  task_handle<_Function2> _Task_handle2(_Func2);
1273  _Task_group.run(_Task_handle2);
1274 
1275  task_handle<_Function3> _Task_handle3(_Func3);
1276  _Task_group.run(_Task_handle3);
1277 
1278  task_handle<_Function4> _Task_handle4(_Func4);
1279  _Task_group.run(_Task_handle4);
1280 
1281  task_handle<_Function5> _Task_handle5(_Func5);
1282  _Task_group.run(_Task_handle5);
1283 
1284  task_handle<_Function6> _Task_handle6(_Func6);
1285  _Task_group.run(_Task_handle6);
1286 
1287  task_handle<_Function7> _Task_handle7(_Func7);
1288  _Task_group.run_and_wait(_Task_handle7);
1289 
1291 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:38
_CONCRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
_CONCRTIMP const GUID PPLParallelInvokeEventGuid
A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to u...
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5,
const _Function6 &  _Func6,
const _Function7 &  _Func7,
const _Function8 &  _Func8 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
_Function6The type of the sixth function object to be executed in parallel.
_Function7The type of the seventh function object to be executed in parallel.
_Function8The type of the eighth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.
_Func6The sixth function object to be executed in parallel.
_Func7The seventh function object to be executed in parallel.
_Func8The eighth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1357 {
1359 
1360  structured_task_group _Task_group;
1361 
1362  task_handle<_Function1> _Task_handle1(_Func1);
1363  _Task_group.run(_Task_handle1);
1364 
1365  task_handle<_Function2> _Task_handle2(_Func2);
1366  _Task_group.run(_Task_handle2);
1367 
1368  task_handle<_Function3> _Task_handle3(_Func3);
1369  _Task_group.run(_Task_handle3);
1370 
1371  task_handle<_Function4> _Task_handle4(_Func4);
1372  _Task_group.run(_Task_handle4);
1373 
1374  task_handle<_Function5> _Task_handle5(_Func5);
1375  _Task_group.run(_Task_handle5);
1376 
1377  task_handle<_Function6> _Task_handle6(_Func6);
1378  _Task_group.run(_Task_handle6);
1379 
1380  task_handle<_Function7> _Task_handle7(_Func7);
1381  _Task_group.run(_Task_handle7);
1382 
1383  task_handle<_Function8> _Task_handle8(_Func8);
1384  _Task_group.run_and_wait(_Task_handle8);
1385 
1387 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:38
_CONCRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
_CONCRTIMP const GUID PPLParallelInvokeEventGuid
A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to u...
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 , typename _Function9 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5,
const _Function6 &  _Func6,
const _Function7 &  _Func7,
const _Function8 &  _Func8,
const _Function9 &  _Func9 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
_Function6The type of the sixth function object to be executed in parallel.
_Function7The type of the seventh function object to be executed in parallel.
_Function8The type of the eighth function object to be executed in parallel.
_Function9The type of the ninth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.
_Func6The sixth function object to be executed in parallel.
_Func7The seventh function object to be executed in parallel.
_Func8The eighth function object to be executed in parallel.
_Func9The ninth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1459 {
1461 
1462  structured_task_group _Task_group;
1463 
1464  task_handle<_Function1> _Task_handle1(_Func1);
1465  _Task_group.run(_Task_handle1);
1466 
1467  task_handle<_Function2> _Task_handle2(_Func2);
1468  _Task_group.run(_Task_handle2);
1469 
1470  task_handle<_Function3> _Task_handle3(_Func3);
1471  _Task_group.run(_Task_handle3);
1472 
1473  task_handle<_Function4> _Task_handle4(_Func4);
1474  _Task_group.run(_Task_handle4);
1475 
1476  task_handle<_Function5> _Task_handle5(_Func5);
1477  _Task_group.run(_Task_handle5);
1478 
1479  task_handle<_Function6> _Task_handle6(_Func6);
1480  _Task_group.run(_Task_handle6);
1481 
1482  task_handle<_Function7> _Task_handle7(_Func7);
1483  _Task_group.run(_Task_handle7);
1484 
1485  task_handle<_Function8> _Task_handle8(_Func8);
1486  _Task_group.run(_Task_handle8);
1487 
1488  task_handle<_Function9> _Task_handle9(_Func9);
1489  _Task_group.run_and_wait(_Task_handle9);
1490 
1492 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:38
_CONCRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
_CONCRTIMP const GUID PPLParallelInvokeEventGuid
A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to u...
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
template<typename _Function1 , typename _Function2 , typename _Function3 , typename _Function4 , typename _Function5 , typename _Function6 , typename _Function7 , typename _Function8 , typename _Function9 , typename _Function10 >
void Concurrency::parallel_invoke ( const _Function1 &  _Func1,
const _Function2 &  _Func2,
const _Function3 &  _Func3,
const _Function4 &  _Func4,
const _Function5 &  _Func5,
const _Function6 &  _Func6,
const _Function7 &  _Func7,
const _Function8 &  _Func8,
const _Function9 &  _Func9,
const _Function10 &  _Func10 
)

Executes the function objects supplied as parameters in parallel, and blocks until they have finished executing. Each function object could be a lambda expression, a pointer to function, or any object that supports the function call operator with the signature void operator()().

Template Parameters
_Function1The type of the first function object to be executed in parallel.
_Function2The type of the second function object to be executed in parallel.
_Function3The type of the third function object to be executed in parallel.
_Function4The type of the fourth function object to be executed in parallel.
_Function5The type of the fifth function object to be executed in parallel.
_Function6The type of the sixth function object to be executed in parallel.
_Function7The type of the seventh function object to be executed in parallel.
_Function8The type of the eighth function object to be executed in parallel.
_Function9The type of the ninth function object to be executed in parallel.
_Function10The type of the tenth function object to be executed in parallel.
Parameters
_Func1The first function object to be executed in parallel.
_Func2The second function object to be executed in parallel.
_Func3The third function object to be executed in parallel.
_Func4The fourth function object to be executed in parallel.
_Func5The fifth function object to be executed in parallel.
_Func6The sixth function object to be executed in parallel.
_Func7The seventh function object to be executed in parallel.
_Func8The eighth function object to be executed in parallel.
_Func9The ninth function object to be executed in parallel.
_Func10The tenth function object to be executed in parallel.

Note that one or more of the function objects supplied as parameters may execute inline on the calling context.

If one or more of the function objects passed as parameters to this function throws an exception, the runtime will select one such exception of its choosing and propagate it out of the call to parallel_invoke.

For more information, see Parallel Algorithms.

1570 {
1572 
1573  structured_task_group _Task_group;
1574 
1575  task_handle<_Function1> _Task_handle1(_Func1);
1576  _Task_group.run(_Task_handle1);
1577 
1578  task_handle<_Function2> _Task_handle2(_Func2);
1579  _Task_group.run(_Task_handle2);
1580 
1581  task_handle<_Function3> _Task_handle3(_Func3);
1582  _Task_group.run(_Task_handle3);
1583 
1584  task_handle<_Function4> _Task_handle4(_Func4);
1585  _Task_group.run(_Task_handle4);
1586 
1587  task_handle<_Function5> _Task_handle5(_Func5);
1588  _Task_group.run(_Task_handle5);
1589 
1590  task_handle<_Function6> _Task_handle6(_Func6);
1591  _Task_group.run(_Task_handle6);
1592 
1593  task_handle<_Function7> _Task_handle7(_Func7);
1594  _Task_group.run(_Task_handle7);
1595 
1596  task_handle<_Function8> _Task_handle8(_Func8);
1597  _Task_group.run(_Task_handle8);
1598 
1599  task_handle<_Function9> _Task_handle9(_Func9);
1600  _Task_group.run(_Task_handle9);
1601 
1602  task_handle<_Function10> _Task_handle10(_Func10);
1603  _Task_group.run_and_wait(_Task_handle10);
1604 
1606 }
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5465
#define _TRACE_LEVEL_INFORMATION
Definition: ppl.h:38
_CONCRTIMP void __cdecl _Trace_ppl_function(const GUID &_Guid, unsigned char _Level, ConcRT_EventType _Type)
_CONCRTIMP const GUID PPLParallelInvokeEventGuid
A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to u...
An event type that marks the beginning of a start/end event pair.
Definition: concrt.h:5460
template<typename _Random_iterator >
void Concurrency::parallel_radixsort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_Random_iteratorThe iterator type of the input range.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. A unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5681 {
5682  typedef typename std::iterator_traits<_Random_iterator>::value_type _DataType;
5683 
5684  _Radix_sort_default_function<_DataType> _Proj_func;
5685 
5686  parallel_radixsort<std::allocator<_DataType>>(_Begin, _End, _Proj_func, 256 * 256);
5687 }
template<typename _Allocator , typename _Random_iterator >
void Concurrency::parallel_radixsort ( const _Allocator &  _Alloc,
const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
Parameters
_AllocAn instance of an STL compatible memory allocator.
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. A unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5722 {
5723  typedef typename std::iterator_traits<_Random_iterator>::value_type _DataType;
5724 
5725  _Radix_sort_default_function<_DataType> _Proj_func;
5726 
5727  parallel_radixsort<_Allocator>(_Alloc, _Begin, _End, _Proj_func);
5728 }
template<typename _Allocator , typename _Random_iterator >
void Concurrency::parallel_radixsort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. A unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5760 {
5761  _Allocator _Alloc;
5762  return parallel_radixsort<_Allocator, _Random_iterator>(_Alloc, _Begin, _End);
5763 }
template<typename _Allocator , typename _Random_iterator , typename _Function >
void Concurrency::parallel_radixsort ( const _Allocator &  _Alloc,
const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Proj_func,
const size_t  _Chunk_size = 256 * 256 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the projection function.
Parameters
_AllocAn instance of an STL compatible memory allocator.
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_Proj_funcA user-defined projection function object that converts an element into an integral value.
_Chunk_sizeThe minimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. A unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5807 {
5808  _CONCRT_ASSERT(_Chunk_size > 0);
5809 
5810  // Check for cancellation before the algorithm starts.
5812 
5813  size_t _Size = _End - _Begin;
5814 
5815  // If _Size <= 1, no more sorting needs to be done.
5816  if (_Size <= 1)
5817  {
5818  return;
5819  }
5820 
5821  _AllocatedBufferHolder<_Allocator> _Holder(_Size, _Alloc);
5822 
5823  // Prevent cancellation from happening during the algorithm in case it leaves the buffers in unknown state.
5825  _Parallel_integer_sort_asc(_Begin, _Size, stdext::make_unchecked_array_iterator(_Holder._Get_buffer()), _Proj_func, _Chunk_size);
5826  }, cancellation_token::none());
5827 }
void _Parallel_integer_sort_asc(const _Random_iterator &_Begin, size_t _Size, const _Random_buffer_iterator &_Output, _Function _Proj_func, const size_t _Chunk_size)
Definition: ppl.h:4958
unchecked_array_iterator< _Iterator > make_unchecked_array_iterator(_Iterator _Ptr)
Definition: iterator:725
void run_with_cancellation_token(const _Function &_Func, cancellation_token _Ct)
Executes a function object immediately and synchronously in the context of a given cancellation token...
Definition: ppl.h:865
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
void interruption_point()
Creates an interruption point for cancellation. If a cancellation is in progress in the context where...
Definition: ppl.h:880
_Size
Definition: vcruntime_string.h:36
template<typename _Allocator , typename _Random_iterator , typename _Function >
void Concurrency::parallel_radixsort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Proj_func,
const size_t  _Chunk_size = 256 * 256 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_AllocatorThe type of an STL compatible memory allocator.
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the projection function.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_Proj_funcA user-defined projection function object that converts an element into an integral value.
_Chunk_sizeThe minimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. A unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5868 {
5869  _Allocator _Alloc;
5870  return parallel_radixsort<_Allocator, _Random_iterator, _Function>(_Alloc, _Begin, _End, _Proj_func, _Chunk_size);
5871 }
template<typename _Random_iterator , typename _Function >
void Concurrency::parallel_radixsort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Proj_func,
const size_t  _Chunk_size = 256 * 256 
)
inline

Arranges elements in a specified range into an non descending order using a radix sorting algorithm. This is a stable sort function which requires a projection function that can project elements to be sorted into unsigned integer-like keys. Default initialization is required for the elements being sorted.

Template Parameters
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the projection function.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_Proj_funcA user-defined projection function object that converts an element into an integral value.
_Chunk_sizeThe minimum size of a chunk that will be split into two for parallel execution.

All overloads require n * sizeof(T) additional space, where n is the number of elements to be sorted, and T is the element type. A unary projection functor with the signature<c>I _Proj_func(T) is required to return a key when given an element, where T is the element type and I is an unsigned integer-like type.

If you do not supply a projection function, a default projection function which simply returns the element is used for integral types. The function will fail to compile if the element is not an integral type in the absence of a projection function.

If you do not supply an allocator type or instance, the STL memory allocator std::allocator<T> is used to allocate the buffer.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5909 {
5910  parallel_radixsort<std::allocator<typename std::iterator_traits<_Random_iterator>::value_type>>(
5911  _Begin, _End, _Proj_func, _Chunk_size);
5912 }
template<typename _Reduce_type , typename _Forward_iterator , typename _Range_reduce_fun , typename _Sym_reduce_fun >
_Reduce_type Concurrency::parallel_reduce ( _Forward_iterator  _Begin,
_Forward_iterator  _End,
const _Reduce_type &  _Identity,
const _Range_reduce_fun &  _Range_fun,
const _Sym_reduce_fun &  _Sym_fun 
)
inline

Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value.

Template Parameters
_Reduce_typeThe type that the input will reduce to, which can be different from the input element type. The return value and identity value will has this type.
_Forward_iteratorThe iterator type of input range.
_Range_reduce_funThe type of the range reduction function. This must be a function type with signature _Reduce_type _Range_fun(_Forward_iterator, _Forward_iterator, _Reduce_type), _Reduce_type is the same as the identity type and the result type of the reduction.
_Sym_reduce_funThe type of the symmetric reduction function. This must be a function type with signature _Reduce_type _Sym_fun(_Reduce_type, _Reduce_type), where _Reduce_type is the same as the identity type and the result type of the reduction. For the third overload, this should be consistent with the output type of _Range_reduce_fun.
Parameters
_BeginAn input iterator addressing the first element in the range to be reduced.
_EndAn input iterator addressing the element that is one position beyond the final element in the range to be reduced.
_IdentityThe identity value _Identity is of the same type as the result type of the reduction and also the value_type of the iterator for the first and second overloads. For the third overload, the identity value must have the same type as the result type of the reduction, but can be different from the value_type of the iterator. It must have an appropriate value such that the range reduction operator _Range_fun , when applied to a range of a single element of type value_type and the identity value, behaves like a type cast of the value from type value_type to the identity type.
_Range_funThe function that will be used in the first phase of the reduction. Refer to Remarks for more information.
_Sym_funThe symmetric function that will be used in the second of the reduction. Refer to Remarks for more information.
Returns
The result of the reduction.

To perform a parallel reduction, the function divides the range into chunks based on the number of workers available to the underlying scheduler. The reduction takes place in two phases, the first phase performs a reduction within each chunk, and the second phase performs a reduction between the partial results from each chunk.

The first overload requires that the iterator's value_type, T, be the same as the identity value type as well as the reduction result type. The element type T must provide the operator T T::operator + (T) to reduce elements in each chunk. The same operator is used in the second phase as well.

The second overload also requires that the iterator's value_type be the same as the identity value type as well as the reduction result type. The supplied binary operator _Sym_fun is used in both reduction phases, with the identity value as the initial value for the first phase.

For the third overload, the identity value type must be the same as the reduction result type, but the iterator's value_type may be different from both. The range reduction function _Range_fun is used in the first phase with the identity value as the initial value, and the binary function _Sym_reduce_fun is applied to sub results in the second phase.

3168 {
3169  typedef typename std::iterator_traits<_Forward_iterator>::value_type _Value_type;
3170 
3171  static_assert(!std::is_same<typename std::iterator_traits<_Forward_iterator>::iterator_category, std::input_iterator_tag>::value
3172  && !std::is_same<typename std::iterator_traits<_Forward_iterator>::iterator_category, std::output_iterator_tag>::value,
3173  "iterator can not be input_iterator or output_iterator.");
3174 
3175  return _Parallel_reduce_impl(_Begin, _End,
3176  _Reduce_functor_helper<_Reduce_type, _Range_reduce_fun,
3177  _Order_combinable<_Reduce_type, _Sym_reduce_fun>>(_Identity, _Range_fun, _Order_combinable<_Reduce_type, _Sym_reduce_fun>(_Sym_fun)),
3178  typename std::iterator_traits<_Forward_iterator>::iterator_category());
3179 }
_Function::_Reduce_type _Parallel_reduce_impl(_Random_iterator _First, _Random_iterator _Last, const _Function &_Func, std::random_access_iterator_tag)
Definition: ppl.h:3340
Definition: xtr1common:326
template<typename _Forward_iterator , typename _Sym_reduce_fun >
std::iterator_traits<_Forward_iterator>::value_type Concurrency::parallel_reduce ( _Forward_iterator  _Begin,
_Forward_iterator  _End,
const typename std::iterator_traits< _Forward_iterator >::value_type &  _Identity,
_Sym_reduce_fun  _Sym_fun 
)
inline

Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value.

Template Parameters
_Forward_iteratorThe iterator type of input range.
_Sym_reduce_funThe type of the symmetric reduction function. This must be a function type with signature _Reduce_type _Sym_fun(_Reduce_type, _Reduce_type), where _Reduce_type is the same as the identity type and the result type of the reduction. For the third overload, this should be consistent with the output type of _Range_reduce_fun.
Parameters
_BeginAn input iterator addressing the first element in the range to be reduced.
_EndAn input iterator addressing the element that is one position beyond the final element in the range to be reduced.
_IdentityThe identity value _Identity is of the same type as the result type of the reduction and also the value_type of the iterator for the first and second overloads. For the third overload, the identity value must have the same type as the result type of the reduction, but can be different from the value_type of the iterator. It must have an appropriate value such that the range reduction operator _Range_fun , when applied to a range of a single element of type value_type and the identity value, behaves like a type cast of the value from type value_type to the identity type.
_Sym_funThe symmetric function that will be used in the second of the reduction. Refer to Remarks for more information.
Returns
The result of the reduction.

To perform a parallel reduction, the function divides the range into chunks based on the number of workers available to the underlying scheduler. The reduction takes place in two phases, the first phase performs a reduction within each chunk, and the second phase performs a reduction between the partial results from each chunk.

The first overload requires that the iterator's value_type, T, be the same as the identity value type as well as the reduction result type. The element type T must provide the operator T T::operator + (T) to reduce elements in each chunk. The same operator is used in the second phase as well.

The second overload also requires that the iterator's value_type be the same as the identity value type as well as the reduction result type. The supplied binary operator _Sym_fun is used in both reduction phases, with the identity value as the initial value for the first phase.

For the third overload, the identity value type must be the same as the reduction result type, but the iterator's value_type may be different from both. The range reduction function _Range_fun is used in the first phase with the identity value as the initial value, and the binary function _Sym_reduce_fun is applied to sub results in the second phase.

3231 {
3232  typedef typename std::remove_cv<typename std::iterator_traits<_Forward_iterator>::value_type>::type _Reduce_type;
3233 
3234  return parallel_reduce(_Begin, _End, _Identity,
3235  [_Sym_fun](_Forward_iterator _Begin, _Forward_iterator _End, _Reduce_type _Init)->_Reduce_type
3236  {
3237  while (_Begin != _End)
3238  {
3239  _Init = _Sym_fun(_Init, *_Begin++);
3240  }
3241 
3242  return _Init;
3243  },
3244  _Sym_fun);
3245 }
std::iterator_traits< _Forward_iterator >::value_type parallel_reduce(_Forward_iterator _Begin, _Forward_iterator _End, const typename std::iterator_traits< _Forward_iterator >::value_type &_Identity)
Computes the sum of all elements in a specified range by computing successive partial sums...
Definition: ppl.h:3287
Definition: xtr1common:326
template<typename _Forward_iterator >
std::iterator_traits<_Forward_iterator>::value_type Concurrency::parallel_reduce ( _Forward_iterator  _Begin,
_Forward_iterator  _End,
const typename std::iterator_traits< _Forward_iterator >::value_type &  _Identity 
)
inline

Computes the sum of all elements in a specified range by computing successive partial sums, or computes the result of successive partial results similarly obtained from using a specified binary operation other than sum, in parallel. parallel_reduce is semantically similar to std::accumulate, except that it requires the binary operation to be associative, and requires an identity value instead of an initial value.

Template Parameters
_Forward_iteratorThe iterator type of input range.
Parameters
_BeginAn input iterator addressing the first element in the range to be reduced.
_EndAn input iterator addressing the element that is one position beyond the final element in the range to be reduced.
_IdentityThe identity value _Identity is of the same type as the result type of the reduction and also the value_type of the iterator for the first and second overloads. For the third overload, the identity value must have the same type as the result type of the reduction, but can be different from the value_type of the iterator. It must have an appropriate value such that the range reduction operator _Range_fun , when applied to a range of a single element of type value_type and the identity value, behaves like a type cast of the value from type value_type to the identity type.
Returns
The result of the reduction.

To perform a parallel reduction, the function divides the range into chunks based on the number of workers available to the underlying scheduler. The reduction takes place in two phases, the first phase performs a reduction within each chunk, and the second phase performs a reduction between the partial results from each chunk.

The first overload requires that the iterator's value_type, T, be the same as the identity value type as well as the reduction result type. The element type T must provide the operator T T::operator + (T) to reduce elements in each chunk. The same operator is used in the second phase as well.

The second overload also requires that the iterator's value_type be the same as the identity value type as well as the reduction result type. The supplied binary operator _Sym_fun is used in both reduction phases, with the identity value as the initial value for the first phase.

For the third overload, the identity value type must be the same as the reduction result type, but the iterator's value_type may be different from both. The range reduction function _Range_fun is used in the first phase with the identity value as the initial value, and the binary function _Sym_reduce_fun is applied to sub results in the second phase.

3289 {
3290  return parallel_reduce(_Begin, _End, _Identity, std::plus<typename std::iterator_traits<_Forward_iterator>::value_type>());
3291 }
std::iterator_traits< _Forward_iterator >::value_type parallel_reduce(_Forward_iterator _Begin, _Forward_iterator _End, const typename std::iterator_traits< _Forward_iterator >::value_type &_Identity)
Computes the sum of all elements in a specified range by computing successive partial sums...
Definition: ppl.h:3287
Definition: xtr1common:326
template<typename _Random_iterator , typename _Function >
void Concurrency::parallel_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End,
const _Function &  _Func,
const size_t  _Chunk_size = 2048 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort.

Template Parameters
_Random_iteratorThe iterator type of the input range.
_FunctionThe type of the binary comparison functor.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.
_FuncA user-defined predicate function object that defines the comparison criterion to be satisfied by successive elements in the ordering. A binary predicate takes two arguments and returns true when satisfied and false when not satisfied. This comparator function must impose a strict weak ordering on pairs of elements from the sequence.
_Chunk_sizeThe minimum size of a chunk that will be split into two for parallel execution.

The first overload uses the binary comparator std::less.

The second overloaded uses the supplied binary comparator that should have the signature bool _Func(T, T) where T is the type of the elements in the input range.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5272 {
5273  _CONCRT_ASSERT(_Chunk_size > 0);
5274 
5275  // Check for cancellation before the algorithm starts.
5277 
5278  size_t _Size = _End - _Begin;
5280 
5281  if (_Size <= _Chunk_size || _Core_num < 2)
5282  {
5283  return std::sort(_Begin, _End, _Func);
5284  }
5285 
5286  _Parallel_quicksort_impl(_Begin, _Size, _Func, _Core_num * _MAX_NUM_TASKS_PER_CORE, _Chunk_size, 0);
5287 }
void _Parallel_quicksort_impl(const _Random_iterator &_Begin, size_t _Size, const _Function &_Func, size_t _Div_num, const size_t _Chunk_size, int _Depth)
Definition: ppl.h:4993
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
void interruption_point()
Creates an interruption point for cancellation. If a cancellation is in progress in the context where...
Definition: ppl.h:880
#define _MAX_NUM_TASKS_PER_CORE
Definition: ppl.h:4541
static _CONCRTIMP unsigned int __cdecl _GetNumberOfVirtualProcessors()
_Size
Definition: vcruntime_string.h:36
void sort(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2781
template<typename _Random_iterator >
void Concurrency::parallel_sort ( const _Random_iterator &  _Begin,
const _Random_iterator &  _End 
)
inline

Arranges the elements in a specified range into a nondescending order, or according to an ordering criterion specified by a binary predicate, in parallel. This function is semantically similar to std::sort in that it is a compare-based, unstable, in-place sort.

Template Parameters
_Random_iteratorThe iterator type of the input range.
Parameters
_BeginA random-access iterator addressing the position of the first element in the range to be sorted.
_EndA random-access iterator addressing the position one past the final element in the range to be sorted.

The first overload uses the binary comparator std::less.

The second overloaded uses the supplied binary comparator that should have the signature bool _Func(T, T) where T is the type of the elements in the input range.

The algorithm divides the input range into two chunks and successively divides each chunk into two sub-chunks for execution in parallel. The optional argument _Chunk_size can be used to indicate to the algorithm that it should handles chunks of size < _Chunk_size serially.

5313 {
5314  parallel_sort(_Begin, _End, std::less<typename std::iterator_traits<_Random_iterator>::value_type>());
5315 }
void parallel_sort(const _Random_iterator &_Begin, const _Random_iterator &_End)
Arranges the elements in a specified range into a nondescending order, or according to an ordering cr...
Definition: ppl.h:5312
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Output_iterator  _Result,
const _Unary_operator&  _Unary_op,
const auto_partitioner &  _Part = auto_partitioner() 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Output_iteratorThe type of the output iterator.
_Unary_operatorThe type of the unary functor to be executed on each element in the input range.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Unary_opA user-defined unary function object that is applied to each element in the source range.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

3855 {
3856  return _Parallel_transform_unary_impl(_First1, _Last1, _Result, _Unary_op, _Part);
3857 }
_Output_iterator _Parallel_transform_unary_impl(_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
Definition: ppl.h:3788
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Output_iterator  _Result,
const _Unary_operator&  _Unary_op,
const static_partitioner &  _Part 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Output_iteratorThe type of the output iterator.
_Unary_operatorThe type of the unary functor to be executed on each element in the input range.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Unary_opA user-defined unary function object that is applied to each element in the source range.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

3912 {
3913  return _Parallel_transform_unary_impl(_First1, _Last1, _Result, _Unary_op, _Part);
3914 }
_Output_iterator _Parallel_transform_unary_impl(_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
Definition: ppl.h:3788
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Output_iterator  _Result,
const _Unary_operator&  _Unary_op,
const simple_partitioner &  _Part 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Output_iteratorThe type of the output iterator.
_Unary_operatorThe type of the unary functor to be executed on each element in the input range.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Unary_opA user-defined unary function object that is applied to each element in the source range.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

3969 {
3970  return _Parallel_transform_unary_impl(_First1, _Last1, _Result, _Unary_op, _Part);
3971 }
_Output_iterator _Parallel_transform_unary_impl(_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
Definition: ppl.h:3788
template<typename _Input_iterator1 , typename _Output_iterator , typename _Unary_operator >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Output_iterator  _Result,
const _Unary_operator&  _Unary_op,
affinity_partitioner &  _Part 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Output_iteratorThe type of the output iterator.
_Unary_operatorThe type of the unary functor to be executed on each element in the input range.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Unary_opA user-defined unary function object that is applied to each element in the source range.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

4026 {
4027  return _Parallel_transform_unary_impl(_First1, _Last1, _Result, _Unary_op, _Part);
4028 }
_Output_iterator _Parallel_transform_unary_impl(_Input_iterator _First, _Input_iterator _Last, _Output_iterator _Result, const _Unary_operator&_Unary_op, _Partitioner &&_Part)
Definition: ppl.h:3788
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator , typename _Partitioner >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Input_iterator2  _First2,
_Output_iterator  _Result,
const _Binary_operator&  _Binary_op,
_Partitioner &&  _Part 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Input_iterator2The type of second input iterator.
_Output_iteratorThe type of the output iterator.
_Binary_operatorThe type of the binary functor executed pairwise on elements from the two source ranges.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_First2An input iterator addressing the position of the first element in the second source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Binary_opA user-defined binary function object that is applied pairwise, in a forward order, to the two source ranges.
_PartA reference to the partitioner object. The argument can be one of const auto_partitioner&, const static_partitioner&, const simple_partitioner& or affinity_partitioner& If an affinity_partitionerobject is used, the reference must be a non-const l-value reference, so that the algorithm can store state for future loops to re-use.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

4090 {
4091  typedef typename std::iterator_traits<_Input_iterator1>::iterator_category _Input_iterator_type1;
4092  typedef typename std::iterator_traits<_Input_iterator2>::iterator_category _Input_iterator_type2;
4093  typedef typename std::iterator_traits<_Output_iterator>::iterator_category _Output_iterator_type;
4094 
4095  if (_First1 != _Last1)
4096  {
4097  _Binary_transform_impl_helper<_Input_iterator_type1, _Input_iterator_type2, _Output_iterator_type>
4098  ::_Parallel_transform_binary_impl(_First1, _Last1, _First2, _Result, _Binary_op, std::forward<_Partitioner>(_Part));
4099  }
4100 
4101  return _Result;
4102 }
template<typename _Input_iterator1 , typename _Input_iterator2 , typename _Output_iterator , typename _Binary_operator >
_Output_iterator Concurrency::parallel_transform ( _Input_iterator1  _First1,
_Input_iterator1  _Last1,
_Input_iterator2  _First2,
_Output_iterator  _Result,
const _Binary_operator&  _Binary_op 
)

Applies a specified function object to each element in a source range, or to a pair of elements from two source ranges, and copies the return values of the function object into a destination range, in parallel. This functional is semantically equivalent to std::transform.

Template Parameters
_Input_iterator1The type of the first or only input iterator.
_Input_iterator2The type of second input iterator.
_Output_iteratorThe type of the output iterator.
_Binary_operatorThe type of the binary functor executed pairwise on elements from the two source ranges.
Parameters
_First1An input iterator addressing the position of the first element in the first or only source range to be operated on.
_Last1An input iterator addressing the position one past the final element in the first or only source range to be operated on.
_First2An input iterator addressing the position of the first element in the second source range to be operated on.
_ResultAn output iterator addressing the position of the first element in the destination range.
_Binary_opA user-defined binary function object that is applied pairwise, in a forward order, to the two source ranges.
Returns
An output iterator addressing the position one past the final element in the destination range that is receiving the output elements transformed by the function object.

auto_partitioner

will be used for the overloads without an explicit partitioner argument.

For iterators that do not support random access, only auto_partitioner

is supported.

The overloads that take the argument _Unary_op transform the input range into the output range by applying the unary functor to each element in the input range. _Unary_op must support the function call operator with signature operator()(T) where T is the value type of the range being iterated over.

The overloads that take the argument _Binary_op transform two input ranges into the output range by applying the binary functor to one element from the first input range and one element from the second input range. _Binary_op must support the function call operator with signature operator()(T, U) where T, U are value types of the two input iterators.

For more information, see Parallel Algorithms.

4155 {
4156  return parallel_transform(_First1, _Last1, _First2, _Result, _Binary_op, auto_partitioner());
4157 }
_Output_iterator parallel_transform(_Input_iterator1 _First1, _Input_iterator1 _Last1, _Input_iterator2 _First2, _Output_iterator _Result, const _Binary_operator&_Binary_op)
Applies a specified function object to each element in a source range, or to a pair of elements from ...
Definition: ppl.h:4153
template<class _Type >
_Type Concurrency::receive ( _Inout_ ISource< _Type > *  _Src,
unsigned int  _Timeout = COOPERATIVE_TIMEOUT_INFINITE 
)

A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_TimeoutThe maximum time for which the method should for the data, in milliseconds.
Returns
A value from the source, of the payload type.

If the parameter _Timeout has a value other than the constant COOPERATIVE_TIMEOUT_INFINITE, the exception operation_timed_out is thrown if the specified amount of time expires before a message is received. If you want a zero length timeout, you should use the try_receive function, as opposed to calling receive with a timeout of 0 (zero), as it is more efficient and does not throw exceptions on timeouts.

For more information, see Message Passing Functions.

See also
try_receive Function, send Function, asend Function
3064 {
3065  return _Receive_impl(_Src, _Timeout, NULL);
3066 }
#define NULL
Definition: vcruntime.h:236
_Type _Receive_impl(ISource< _Type > *_Src, unsigned int _Timeout, typename ITarget< _Type >::filter_method const *_Filter_proc)
A general receive implementation, allowing a context to wait for data from exactly one source and fil...
Definition: agents.h:2808
template<class _Type >
_Type Concurrency::receive ( _Inout_ ISource< _Type > *  _Src,
typename ITarget< _Type >::filter_method const &  _Filter_proc,
unsigned int  _Timeout = COOPERATIVE_TIMEOUT_INFINITE 
)

A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_Filter_procA filter function which determines whether messages should be accepted.
_TimeoutThe maximum time for which the method should for the data, in milliseconds.
Returns
A value from the source, of the payload type.

If the parameter _Timeout has a value other than the constant COOPERATIVE_TIMEOUT_INFINITE, the exception operation_timed_out is thrown if the specified amount of time expires before a message is received. If you want a zero length timeout, you should use the try_receive function, as opposed to calling receive with a timeout of 0 (zero), as it is more efficient and does not throw exceptions on timeouts.

For more information, see Message Passing Functions.

See also
try_receive Function, send Function, asend Function
3101 {
3102  return _Receive_impl(_Src, _Timeout, &_Filter_proc);
3103 }
_Type _Receive_impl(ISource< _Type > *_Src, unsigned int _Timeout, typename ITarget< _Type >::filter_method const *_Filter_proc)
A general receive implementation, allowing a context to wait for data from exactly one source and fil...
Definition: agents.h:2808
template<class _Type >
_Type Concurrency::receive ( ISource< _Type > &  _Src,
unsigned int  _Timeout = COOPERATIVE_TIMEOUT_INFINITE 
)

A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_TimeoutThe maximum time for which the method should for the data, in milliseconds.
Returns
A value from the source, of the payload type.

If the parameter _Timeout has a value other than the constant COOPERATIVE_TIMEOUT_INFINITE, the exception operation_timed_out is thrown if the specified amount of time expires before a message is received. If you want a zero length timeout, you should use the try_receive function, as opposed to calling receive with a timeout of 0 (zero), as it is more efficient and does not throw exceptions on timeouts.

For more information, see Message Passing Functions.

See also
try_receive Function, send Function, asend Function
3135 {
3136  return _Receive_impl(&_Src, _Timeout, NULL);
3137 }
#define NULL
Definition: vcruntime.h:236
_Type _Receive_impl(ISource< _Type > *_Src, unsigned int _Timeout, typename ITarget< _Type >::filter_method const *_Filter_proc)
A general receive implementation, allowing a context to wait for data from exactly one source and fil...
Definition: agents.h:2808
template<class _Type >
_Type Concurrency::receive ( ISource< _Type > &  _Src,
typename ITarget< _Type >::filter_method const &  _Filter_proc,
unsigned int  _Timeout = COOPERATIVE_TIMEOUT_INFINITE 
)

A general receive implementation, allowing a context to wait for data from exactly one source and filter the values that are accepted.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_Filter_procA filter function which determines whether messages should be accepted.
_TimeoutThe maximum time for which the method should for the data, in milliseconds.
Returns
A value from the source, of the payload type.

If the parameter _Timeout has a value other than the constant COOPERATIVE_TIMEOUT_INFINITE, the exception operation_timed_out is thrown if the specified amount of time expires before a message is received. If you want a zero length timeout, you should use the try_receive function, as opposed to calling receive with a timeout of 0 (zero), as it is more efficient and does not throw exceptions on timeouts.

For more information, see Message Passing Functions.

See also
try_receive Function, send Function, asend Function
3172 {
3173  return _Receive_impl(&_Src, _Timeout, &_Filter_proc);
3174 }
_Type _Receive_impl(ISource< _Type > *_Src, unsigned int _Timeout, typename ITarget< _Type >::filter_method const *_Filter_proc)
A general receive implementation, allowing a context to wait for data from exactly one source and fil...
Definition: agents.h:2808
template<typename _Function >
void Concurrency::run_with_cancellation_token ( const _Function &  _Func,
cancellation_token  _Ct 
)

Executes a function object immediately and synchronously in the context of a given cancellation token.

Template Parameters
_FunctionThe type of the function object that will be invoked.
Parameters
_FuncThe function object which will be executed. This object must support the function call operator with a signature of void(void).
_CtThe cancellation token which will control implicit cancellation of the function object. Use cancellation_token::none() if you want the function execute without any possibility of implicit cancellation from a parent task group being canceled.

Any interruption points in the function object will be triggered when the cancellation_token is canceled. The explicit token _Ct will isolate this _Func from parent cancellation if the parent has a different token or no token.

866 {
867  structured_task_group _Stg(_Ct);
868  _Stg.run_and_wait(_Func);
869 }
template<class _Type >
bool Concurrency::send ( _Inout_ ITarget< _Type > *  _Trg,
const _Type &  _Data 
)

A synchronous send operation, which waits until the target either accepts or declines the message.

Template Parameters
_TypeThe payload type.
Parameters
_TrgA pointer or reference to the target to which data is sent.
_DataA reference to the data to be sent.
Returns
true if the message was accepted, false otherwise.

For more information, see Message Passing Functions.

See also
receive Function, try_receive Function, asend Function
4338 {
4339  return details::_Originator::_send(_Trg, _Data);
4340 }
template<class _Type >
bool Concurrency::send ( ITarget< _Type > &  _Trg,
const _Type &  _Data 
)

A synchronous send operation, which waits until the target either accepts or declines the message.

Template Parameters
_TypeThe payload type.
Parameters
_TrgA pointer or reference to the target to which data is sent.
_DataA reference to the data to be sent.
Returns
true if the message was accepted, false otherwise.

For more information, see Message Passing Functions.

See also
receive Function, try_receive Function, asend Function
4367 {
4368  return ::Concurrency::send(&_Trg, _Data);
4369 }
bool send(ITarget< _Type > &_Trg, const _Type &_Data)
A synchronous send operation, which waits until the target either accepts or declines the message...
Definition: agents.h:4366
void Concurrency::set_ambient_scheduler ( const ::std::shared_ptr< scheduler_interface > &  _Scheduler)
inline
94 {
96 }
inline::std::shared_ptr< scheduler_interface > & _GetStaticAmbientSchedulerRef()
Definition: pplwin.h:80
template<typename _Ty , class _Ax >
void Concurrency::swap ( concurrent_vector< _Ty, _Ax > &  _A,
concurrent_vector< _Ty, _Ax > &  _B 
)
inline

Exchanges the elements of two concurrent_vector objects.

Template Parameters
_TyThe data type of the elements stored in the concurrent vectors.
_AxThe allocator type of the concurrent vectors.
Parameters
_BThe concurrent vector providing the elements to be swapped, or the vector whose elements are to be exchanged with those of the concurrent vector _A .
_AThe concurrent vector whose elements are to be exchanged with those of the concurrent vector _B .

The template function is an algorithm specialized on the container class concurrent_vector to execute the member function _A .concurrent_vector::swap(_B ). These are instances of the partial ordering of function templates by the compiler. When template functions are overloaded in such a way that the match of the template with the function call is not unique, then the compiler will select the most specialized version of the template function. The general version of the template function, template <class T> void swap(T&, T&), in the algorithm class works by assignment and is a slow operation. The specialized version in each container is much faster as it can work with the internal representation of the container class.

This method is not concurrency-safe. You must ensure that no other threads are performing operations on either of the concurrent vectors when you call this method.

See also
concurrent_vector Class, Parallel Containers and Objects
1963 {
1964  _A.swap( _B );
1965 }
void Concurrency::tile_static_memory_fence ( const tile_barrier &  _Barrier)
inline

Ensures that tile_static memory accesses are visible to other threads in the thread tile, and are executed according to program order

Parameters
_BarrierA tile_barrier object
7201 {
7203 }
void __dp_d3d_tile_static_memory_fence() __GPU_ONLY
template<class _Type >
void Concurrency::Trace_agents_register_name ( _Inout_ _Type *  _PObject,
_In_z_ const wchar_t _Name 
)

Associates the given name to the message block or agent in the ETW trace.

Template Parameters
_TypeThe type of the object. This is typically a message block or an agent.
Parameters
_PObjectA pointer to the message block or agent that is being named in the trace.
_NameThe name for the given object.
13535 {
13537 }
__int64 _Trace_agents_get_id(_Type *_PObject)
Definition: agents.h:435
An event type that represents the name for an object
Definition: concrt.h:5691
_CONCRTIMP void __cdecl _Trace_agents(Agents_EventType _Type, __int64 _AgentId,...)
template<class _Type >
bool Concurrency::try_receive ( _Inout_ ISource< _Type > *  _Src,
_Type &  _value 
)

A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_valueA reference to a location where the result will be placed.
Returns
A bool value indicating whether or not a payload was placed in _value .

For more information, see Message Passing Functions.

See also
receive Function, send Function, asend Function
3422 {
3423  return _Try_receive_impl(_Src, _value, NULL);
3424 }
#define NULL
Definition: vcruntime.h:236
bool _Try_receive_impl(ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const *_Filter_proc)
Helper function that implements try_receive A general try-receive implementation, allowing a context ...
Definition: agents.h:3199
template<class _Type >
bool Concurrency::try_receive ( _Inout_ ISource< _Type > *  _Src,
_Type &  _value,
typename ITarget< _Type >::filter_method const &  _Filter_proc 
)

A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false.

Template Parameters
_TypeThe payload type.
Parameters
_SrcA pointer or reference to the source from which data is expected.
_valueA reference to a location where the result will be placed.
_Filter_procA filter function which determines whether messages should be accepted.
Returns
A bool value indicating whether or not a payload was placed in _value .

For more information, see Message Passing Functions.

See also
receive Function, send Function, asend Function
3455 {
3456  return _Try_receive_impl(_Src, _value, &_Filter_proc);
3457 }
bool _Try_receive_impl(ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const *_Filter_proc)
Helper function that implements try_receive A general try-receive implementation, allowing a context ...
Definition: agents.h:3199
template<class _Type >
bool Concurrency::try_receive ( ISource< _Type > &  _Src,
_Type &  _value 
)

A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false.

Template Parameters
_TypeThe payload type
Parameters
_SrcA pointer or reference to the source from which data is expected.
_valueA reference to a location where the result will be placed.
Returns
A bool value indicating whether or not a payload was placed in _value .

For more information, see Message Passing Functions.

See also
receive Function, send Function, asend Function
3485 {
3486  return _Try_receive_impl(&_Src, _value, NULL);
3487 }
#define NULL
Definition: vcruntime.h:236
bool _Try_receive_impl(ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const *_Filter_proc)
Helper function that implements try_receive A general try-receive implementation, allowing a context ...
Definition: agents.h:3199
template<class _Type >
bool Concurrency::try_receive ( ISource< _Type > &  _Src,
_Type &  _value,
typename ITarget< _Type >::filter_method const &  _Filter_proc 
)

A general try-receive implementation, allowing a context to look for data from exactly one source and filter the values that are accepted. If the data is not ready, the method will return false.

Template Parameters
_TypeThe payload type
Parameters
_SrcA pointer or reference to the source from which data is expected.
_valueA reference to a location where the result will be placed.
_Filter_procA filter function which determines whether messages should be accepted.
Returns
A bool value indicating whether or not a payload was placed in _value .

For more information, see Message Passing Functions.

See also
receive Function, send Function, asend Function
3518 {
3519  return _Try_receive_impl(&_Src, _value, &_Filter_proc);
3520 }
bool _Try_receive_impl(ISource< _Type > *_Src, _Type &_value, typename ITarget< _Type >::filter_method const *_Filter_proc)
Helper function that implements try_receive A general try-receive implementation, allowing a context ...
Definition: agents.h:3199
_CONCRTIMP void __cdecl Concurrency::wait ( unsigned int  _Milliseconds)

Pauses the current context for a specified amount of time.

Parameters
_MillisecondsThe number of milliseconds the current context should be paused for. If the _Milliseconds parameter is set to the value 0, the current context should yield execution to other runnable contexts before continuing.

If this method is called on a Concurrency Runtime scheduler context, the scheduler will find a different context to run on the underlying resource. Because the scheduler is cooperative in nature, this context cannot resume exactly after the number of milliseconds specified. If the scheduler is busy executing other tasks that do not cooperatively yield to the scheduler, the wait period could be indefinite.

Variable Documentation

_CONCRTIMP const GUID Concurrency::AgentEventGuid

A category GUID ({B9B5B78C-0713-4898-A21A-C67949DCED07}) describing ETW events fired by the Agents library in the Concurrency Runtime.

_CONCRTIMP const GUID Concurrency::ChoreEventGuid

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to chores or tasks.

This category of events is not currently fired by the Concurrency Runtime.

See also
task_group Class, structured_task_group Class
_CONCRTIMP const GUID Concurrency::ConcRT_ProviderGuid

The ETW provider GUID for the Concurrency Runtime.

_CONCRTIMP const GUID Concurrency::ConcRTEventGuid

A category GUID describing ETW events fired by the Concurrency Runtime that are not more specifically described by another category.

This category of events is not currently fired by the Concurrency Runtime.

_CONCRTIMP const GUID Concurrency::ContextEventGuid

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to contexts.

See also
Context Class
const unsigned int Concurrency::COOPERATIVE_TIMEOUT_INFINITE = (unsigned int)-1

Value indicating that a wait should never time out.

See also
event Class, event::wait Method, event::wait_for_multiple Method
const size_t Concurrency::COOPERATIVE_WAIT_TIMEOUT = SIZE_MAX

Value indicating that a wait timed out.

See also
event Class, event::wait Method, event::wait_for_multiple Method
_CONCRTIMP const GUID Concurrency::LockEventGuid

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to locks.

This category of events is not currently fired by the Concurrency Runtime.

See also
critical_section Class, reader_writer_lock Class
_CONCRTIMP const GUID Concurrency::PPLParallelForeachEventGuid

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to usage of the parallel_for_each function.

See also
parallel_for_each Function
_CONCRTIMP const GUID Concurrency::PPLParallelForEventGuid

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to usage of the parallel_for function.

See also
parallel_for Function
_CONCRTIMP const GUID Concurrency::PPLParallelInvokeEventGuid

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to usage of the parallel_invoke function.

See also
parallel_invoke Function
_CONCRTIMP const GUID Concurrency::ResourceManagerEventGuid

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to the resource manager.

This category of events is not currently fired by the Concurrency Runtime.

See also
IResourceManager Structure
_CONCRTIMP const GUID Concurrency::ScheduleGroupEventGuid

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to schedule groups.

This category of events is not currently fired by the Concurrency Runtime.

See also
ScheduleGroup Class
_CONCRTIMP const GUID Concurrency::SchedulerEventGuid

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to scheduler activity.

See also
CurrentScheduler Class, Scheduler Class
_CONCRTIMP const GUID Concurrency::VirtualProcessorEventGuid

A category GUID describing ETW events fired by the Concurrency Runtime that are directly related to virtual processors.