8 #include <density/detail/function_runtime_type.h> 9 #include <density/sp_heter_queue.h> 19 typename BUSY_WAIT_FUNC = default_busy_wait>
58 #ifndef DOXYGEN_DOC_GENERATION 62 typename ALLOCATOR_TYPE,
66 typename BUSY_WAIT_FUNC>
87 detail::FunctionRuntimeType<ERASURE, RET_VAL(PARAMS...)>,
129 swap(i_first.m_queue, i_second.m_queue);
135 auto erasure = ERASURE;
143 template <
typename ELEMENT_COMPLETE_TYPE>
148 template <
typename ELEMENT_COMPLETE_TYPE>
165 template <
typename ELEMENT_COMPLETE_TYPE>
void push(ELEMENT_COMPLETE_TYPE && i_source)
167 m_queue.
push(std::forward<ELEMENT_COMPLETE_TYPE>(i_source));
177 template <
typename ELEMENT_COMPLETE_TYPE,
typename... CONSTRUCTION_PARAMS>
178 void emplace(CONSTRUCTION_PARAMS &&... i_construction_params)
180 m_queue.template emplace<ELEMENT_COMPLETE_TYPE>(
181 std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
191 template <
typename ELEMENT_TYPE>
195 return m_queue.
start_push(std::forward<ELEMENT_TYPE>(i_source));
206 template <
typename ELEMENT_TYPE,
typename... CONSTRUCTION_PARAMS>
209 return m_queue.template start_emplace<ELEMENT_TYPE>(
210 std::forward<ELEMENT_TYPE>(i_construction_params)...);
218 template <
typename ELEMENT_COMPLETE_TYPE>
221 m_queue.
reentrant_push(std::forward<ELEMENT_COMPLETE_TYPE>(i_source));
231 template <
typename ELEMENT_COMPLETE_TYPE,
typename... CONSTRUCTION_PARAMS>
234 m_queue.template reentrant_emplace<ELEMENT_COMPLETE_TYPE>(
235 std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
245 template <
typename ELEMENT_TYPE>
260 template <
typename ELEMENT_TYPE,
typename... CONSTRUCTION_PARAMS>
264 return m_queue.template start_reentrant_emplace<ELEMENT_TYPE>(
265 std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
273 template <
typename ELEMENT_COMPLETE_TYPE>
276 ELEMENT_COMPLETE_TYPE &&
277 i_source) noexcept(noexcept(m_queue
279 i_progress_guarantee,
280 std::forward<ELEMENT_COMPLETE_TYPE>(i_source))))
283 i_progress_guarantee, std::forward<ELEMENT_COMPLETE_TYPE>(i_source));
293 template <
typename ELEMENT_COMPLETE_TYPE,
typename... CONSTRUCTION_PARAMS>
296 noexcept(m_queue.template
try_emplace<ELEMENT_COMPLETE_TYPE>(
297 i_progress_guarantee,
std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...)))
299 return m_queue.template try_emplace<ELEMENT_COMPLETE_TYPE>(
300 i_progress_guarantee, std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
310 template <
typename ELEMENT_TYPE>
313 ELEMENT_TYPE && i_source) noexcept(noexcept(m_queue
315 i_progress_guarantee,
316 std::forward<ELEMENT_TYPE>(i_source))))
319 i_progress_guarantee, std::forward<ELEMENT_TYPE>(i_source));
330 template <
typename ELEMENT_TYPE,
typename... CONSTRUCTION_PARAMS>
333 CONSTRUCTION_PARAMS &&... i_construction_params) noexcept(noexcept(m_queue
336 i_progress_guarantee,
339 i_construction_params)...)))
341 return m_queue.template try_start_emplace<ELEMENT_TYPE>(
342 i_progress_guarantee, std::forward<ELEMENT_TYPE>(i_construction_params)...);
350 template <
typename ELEMENT_COMPLETE_TYPE>
353 ELEMENT_COMPLETE_TYPE &&
354 i_source) noexcept(noexcept(m_queue
356 i_progress_guarantee,
357 std::forward<ELEMENT_COMPLETE_TYPE>(i_source))))
360 i_progress_guarantee, std::forward<ELEMENT_COMPLETE_TYPE>(i_source));
370 template <
typename ELEMENT_COMPLETE_TYPE,
typename... CONSTRUCTION_PARAMS>
373 CONSTRUCTION_PARAMS &&... i_construction_params) noexcept(noexcept(m_queue
375 ELEMENT_COMPLETE_TYPE>(
376 i_progress_guarantee,
378 CONSTRUCTION_PARAMS>(
379 i_construction_params)...)))
381 return m_queue.template try_reentrant_emplace<ELEMENT_COMPLETE_TYPE>(
382 i_progress_guarantee, std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
392 template <
typename ELEMENT_TYPE>
395 ELEMENT_TYPE && i_source) noexcept(noexcept(m_queue
397 i_progress_guarantee,
398 std::forward<ELEMENT_TYPE>(i_source))))
401 i_progress_guarantee, std::forward<ELEMENT_TYPE>(i_source));
412 template <
typename ELEMENT_TYPE,
typename... CONSTRUCTION_PARAMS>
415 CONSTRUCTION_PARAMS &&... i_construction_params) noexcept(noexcept(m_queue
418 i_progress_guarantee,
421 i_construction_params)...)))
423 return m_queue.template try_start_reentrant_emplace<ELEMENT_TYPE>(
424 i_progress_guarantee, std::forward<ELEMENT_TYPE>(i_construction_params)...);
446 return try_consume_impl(std::is_void<RET_VAL>(), std::forward<PARAMS>(i_params)...);
469 typename std::conditional<std::is_void<RET_VAL>::value, bool,
optional<RET_VAL>>::type
472 return try_consume_impl_cached(
473 std::is_void<RET_VAL>(), i_consume, std::forward<PARAMS>(i_params)...);
494 return try_reentrant_consume_impl(
495 std::is_void<RET_VAL>(), std::forward<PARAMS>(i_params)...);
517 typename std::conditional<std::is_void<RET_VAL>::value, bool,
optional<RET_VAL>>::type
520 return try_reentrant_consume_impl_cached(
521 std::is_void<RET_VAL>(), i_consume, std::forward<PARAMS>(i_params)...);
533 typename std::enable_if<ERASURE_ != function_manual_clear>::type * =
nullptr>
536 auto erasure = ERASURE;
556 auto && result = cons.complete_type().align_invoke_destroy(
557 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
558 cons.commit_nodestroy();
568 bool try_consume_impl(std::true_type, PARAMS... i_params)
572 cons.complete_type().align_invoke_destroy(
573 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
574 cons.commit_nodestroy();
589 auto && result = i_consume.complete_type().align_invoke_destroy(
590 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
591 i_consume.commit_nodestroy();
602 try_consume_impl_cached(std::true_type,
consume_operation & i_consume, PARAMS... i_params)
606 i_consume.complete_type().align_invoke_destroy(
607 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
608 i_consume.commit_nodestroy();
618 optional<RET_VAL> try_reentrant_consume_impl(std::false_type, PARAMS... i_params)
622 auto && result = cons.complete_type().align_invoke_destroy(
623 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
624 cons.commit_nodestroy();
634 bool try_reentrant_consume_impl(std::true_type, PARAMS... i_params)
638 cons.complete_type().align_invoke_destroy(
639 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
640 cons.commit_nodestroy();
655 auto && result = i_consume.complete_type().align_invoke_destroy(
656 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
657 i_consume.commit_nodestroy();
667 bool try_reentrant_consume_impl_cached(
672 i_consume.complete_type().align_invoke_destroy(
673 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
674 i_consume.commit_nodestroy();
friend void swap(sp_function_queue &i_first, sp_function_queue &i_second) noexcept
Definition: sp_function_queue.h:126
static constexpr bool is_seq_cst
Definition: sp_function_queue.h:106
put_transaction< typename std::decay< ELEMENT_TYPE >::type > try_start_push(progress_guarantee i_progress_guarantee, ELEMENT_TYPE &&i_source) noexcept(noexcept(m_queue .try_start_push( i_progress_guarantee, std::forward< ELEMENT_TYPE >(i_source))))
Definition: sp_function_queue.h:311
basic_default_allocator< default_page_capacity > default_allocator
Definition: default_allocator.h:152
concurrency_cardinality
Definition: density_common.h:56
Definition: conc_function_queue.h:11
typename UnderlyingQueue::consume_operation consume_operation
Definition: sp_function_queue.h:153
bool try_push(progress_guarantee i_progress_guarantee, ELEMENT_COMPLETE_TYPE &&i_source) noexcept(noexcept(m_queue .try_push( i_progress_guarantee, std::forward< ELEMENT_COMPLETE_TYPE >(i_source))))
Definition: sp_function_queue.h:274
std::conditional< std::is_void< RET_VAL >::value, bool, density::optional< RET_VAL > >::type try_consume(PARAMS...i_params)
Definition: sp_function_queue.h:444
void reentrant_push(ELEMENT_COMPLETE_TYPE &&i_source)
Definition: sp_function_queue.h:219
Definition: density_common.h:60
void reentrant_push(ELEMENT_TYPE &&i_source)
Definition: sp_heter_queue.h:2778
void push(ELEMENT_COMPLETE_TYPE &&i_source)
Definition: sp_function_queue.h:165
put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_push(ELEMENT_TYPE &&i_source)
Definition: sp_function_queue.h:193
reentrant_put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_reentrant_push(ELEMENT_TYPE &&i_source)
Definition: sp_heter_queue.h:2834
Definition: runtime_type.h:1061
typename UnderlyingQueue::template reentrant_put_transaction< ELEMENT_COMPLETE_TYPE > reentrant_put_transaction
Definition: sp_function_queue.h:150
static constexpr bool concurrent_put_consumes
Definition: sp_function_queue.h:103
sp_function_queue() noexcept=default
static constexpr bool concurrent_puts
Definition: sp_function_queue.h:96
void clear() noexcept
Definition: sp_heter_queue.h:483
#define DENSITY_ASSERT(...)
Definition: density_config.h:19
typename UnderlyingQueue::template put_transaction< ELEMENT_COMPLETE_TYPE > put_transaction
Definition: sp_function_queue.h:145
void emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: sp_function_queue.h:178
reentrant_put_transaction< ELEMENT_TYPE > start_reentrant_emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: sp_function_queue.h:262
void clear() noexcept
Definition: sp_function_queue.h:534
bool try_reentrant_push(progress_guarantee i_progress_guarantee, ELEMENT_COMPLETE_TYPE &&i_source) noexcept(noexcept(m_queue .try_reentrant_push( i_progress_guarantee, std::forward< ELEMENT_COMPLETE_TYPE >(i_source))))
Definition: sp_function_queue.h:351
std::conditional< std::is_void< RET_VAL >::value, bool, optional< RET_VAL > >::type try_consume(consume_operation &i_consume, PARAMS...i_params)
Definition: sp_function_queue.h:470
Definition: density_common.h:99
put_transaction< typename std::decay< ELEMENT_TYPE >::type > try_start_push(progress_guarantee i_progress_guarantee, ELEMENT_TYPE &&i_source) noexcept(noexcept(std::declval< sp_heter_queue >() .template try_start_emplace< typename std::decay< ELEMENT_TYPE >::type >( i_progress_guarantee, std::forward< ELEMENT_TYPE >(i_source))))
Definition: sp_heter_queue.h:1740
void reentrant_emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: sp_function_queue.h:232
Definition: sp_heter_queue.h:47
reentrant_put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_reentrant_push(ELEMENT_TYPE &&i_source)
Definition: sp_function_queue.h:247
std::conditional< std::is_void< RET_VAL >::value, bool, optional< RET_VAL > >::type try_reentrant_consume(reentrant_consume_operation &i_consume, PARAMS...i_params)
Definition: sp_function_queue.h:518
progress_guarantee
Definition: density_common.h:84
reentrant_put_transaction< typename std::decay< ELEMENT_TYPE >::type > try_start_reentrant_push(progress_guarantee i_progress_guarantee, ELEMENT_TYPE &&i_source) noexcept(noexcept(std::declval< sp_heter_queue >() .template try_start_reentrant_emplace< typename std::decay< ELEMENT_TYPE >::type >( i_progress_guarantee, std::forward< ELEMENT_TYPE >(i_source))))
Definition: sp_heter_queue.h:3067
bool try_emplace(progress_guarantee i_progress_guarantee, CONSTRUCTION_PARAMS &&...i_construction_params) noexcept( noexcept(m_queue.template try_emplace< ELEMENT_COMPLETE_TYPE >( i_progress_guarantee, std::forward< CONSTRUCTION_PARAMS >(i_construction_params)...)))
Definition: sp_function_queue.h:295
Definition: density_common.h:101
bool empty() const noexcept
Definition: sp_heter_queue.h:474
put_transaction< ELEMENT_TYPE > try_start_emplace(progress_guarantee i_progress_guarantee, CONSTRUCTION_PARAMS &&...i_construction_params) noexcept(noexcept(m_queue .template try_start_emplace< ELEMENT_TYPE >( i_progress_guarantee, std::forward< ELEMENT_TYPE >( i_construction_params)...)))
Definition: sp_function_queue.h:331
builtin_optional< TYPE > optional
Definition: density_config.h:218
bool empty() noexcept
Definition: sp_function_queue.h:548
static constexpr bool concurrent_consumes
Definition: sp_function_queue.h:99
bool try_reentrant_emplace(progress_guarantee i_progress_guarantee, CONSTRUCTION_PARAMS &&...i_construction_params) noexcept(noexcept(m_queue .template try_reentrant_emplace< ELEMENT_COMPLETE_TYPE >( i_progress_guarantee, std::forward< CONSTRUCTION_PARAMS >( i_construction_params)...)))
Definition: sp_function_queue.h:371
typename UnderlyingQueue::reentrant_consume_operation reentrant_consume_operation
Definition: sp_function_queue.h:156
reentrant_put_transaction< ELEMENT_TYPE > try_start_reentrant_emplace(progress_guarantee i_progress_guarantee, CONSTRUCTION_PARAMS &&...i_construction_params) noexcept(noexcept(m_queue .template try_start_reentrant_emplace< ELEMENT_TYPE >( i_progress_guarantee, std::forward< ELEMENT_TYPE >( i_construction_params)...)))
Definition: sp_function_queue.h:413
std::conditional< std::is_void< RET_VAL >::value, bool, density::optional< RET_VAL > >::type try_reentrant_consume(PARAMS...i_params)
Definition: sp_function_queue.h:492
reentrant_put_transaction< typename std::decay< ELEMENT_TYPE >::type > try_start_reentrant_push(progress_guarantee i_progress_guarantee, ELEMENT_TYPE &&i_source) noexcept(noexcept(m_queue .try_start_reentrant_push( i_progress_guarantee, std::forward< ELEMENT_TYPE >(i_source))))
Definition: sp_function_queue.h:393
void push(ELEMENT_TYPE &&i_source)
Definition: sp_heter_queue.h:1207
function_type_erasure
Definition: density_common.h:97
reentrant_consume_operation try_start_reentrant_consume() noexcept
Definition: sp_heter_queue.h:3283
consume_operation try_start_consume() noexcept
Definition: sp_heter_queue.h:2045
Definition: sp_function_queue.h:20
~sp_function_queue()
Definition: sp_function_queue.h:133
bool try_push(progress_guarantee i_progress_guarantee, ELEMENT_TYPE &&i_source) noexcept( noexcept(std::declval< sp_heter_queue >() .template try_emplace< typename std::decay< ELEMENT_TYPE >::type >( i_progress_guarantee, std::forward< ELEMENT_TYPE >(i_source))))
Definition: sp_heter_queue.h:1552
#define DENSITY_ASSUME(bool_expr,...)
Definition: density_config.h:46
put_transaction< ELEMENT_TYPE > start_emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: sp_function_queue.h:207
bool try_reentrant_push(progress_guarantee i_progress_guarantee, ELEMENT_TYPE &&i_source) noexcept(noexcept(std::declval< sp_heter_queue >() .template try_reentrant_emplace< typename std::decay< ELEMENT_TYPE >::type >( i_progress_guarantee, std::forward< ELEMENT_TYPE >(i_source))))
Definition: sp_heter_queue.h:2980
put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_push(ELEMENT_TYPE &&i_source)
Definition: sp_heter_queue.h:1326