21 #ifndef __TBB__aggregator_impl_H 22 #define __TBB__aggregator_impl_H 24 #include "../atomic.h" 25 #if !__TBBMALLOC_BUILD 26 #include "../tbb_profiling.h" 30 namespace interface6 {
36 template <
typename Derived>
50 template <
typename operation_type >
63 template <
typename handler_type >
64 void execute(operation_type *op, handler_type &handle_operations,
bool long_life_time =
true) {
69 const uintptr_t status = op->status;
76 call_itt_notify(releasing, &(op->status));
81 op->next = res = pending_operations;
82 }
while (pending_operations.compare_and_swap(op, res) != res);
87 call_itt_notify(acquired, &pending_operations);
88 start_handle_operations(handle_operations);
91 __TBB_ASSERT(op->status, NULL);
95 __TBB_ASSERT(long_life_time,
"The blocking operation cannot have 'short' life time. Since it can already be destroyed.");
96 call_itt_notify(prepare, &(op->status));
97 spin_wait_while_eq(op->status, uintptr_t(0));
98 itt_load_word_with_acquire(op->status);
106 uintptr_t handler_busy;
109 template <
typename handler_type >
110 void start_handle_operations( handler_type &handle_operations ) {
111 operation_type *op_list;
119 call_itt_notify(prepare, &handler_busy);
122 spin_wait_until_eq(handler_busy, uintptr_t(0));
123 call_itt_notify(acquired, &handler_busy);
125 __TBB_store_with_release(handler_busy, uintptr_t(1));
131 call_itt_notify(releasing, &pending_operations);
133 op_list = pending_operations.fetch_and_store(NULL);
136 handle_operations(op_list);
139 itt_store_word_with_release(handler_busy, uintptr_t(0));
143 template <
typename handler_type,
typename operation_type >
145 handler_type handle_operations;
148 explicit aggregator(handler_type h) : handle_operations(h) {}
150 void initialize_handler(handler_type h) { handle_operations = h; }
152 void execute(operation_type *op) {
159 template<
typename aggregating_
class,
typename operation_list>
161 aggregating_class *fi;
165 void operator()(operation_list* op_list) { fi->handle_operations(op_list); }
180 #endif // __TBB__aggregator_impl_H Definition: _aggregator_impl.h:160
Aggregator base class.
Definition: _aggregator_impl.h:51
aggregated_operation base class
Definition: _aggregator_impl.h:37
Definition: _aggregator_impl.h:144
void execute(operation_type *op, handler_type &handle_operations, bool long_life_time=true)
Place operation in list.
Definition: _aggregator_impl.h:64
Primary template for atomic.
Definition: atomic.h:405
Definition: _flow_graph_async_msg_impl.h:32
The namespace tbb contains all components of the library.
Definition: parallel_for.h:44