8 #include <density/detail/function_runtime_type.h> 9 #include <density/lf_heter_queue.h> 65 #ifndef DOXYGEN_DOC_GENERATION 69 typename ALLOCATOR_TYPE,
94 detail::FunctionRuntimeType<ERASURE, RET_VAL(PARAMS...)>,
136 swap(i_first.m_queue, i_second.m_queue);
142 auto erasure = ERASURE;
150 template <
typename ELEMENT_COMPLETE_TYPE>
155 template <
typename ELEMENT_COMPLETE_TYPE>
172 template <
typename ELEMENT_COMPLETE_TYPE>
void push(ELEMENT_COMPLETE_TYPE && i_source)
174 m_queue.
push(std::forward<ELEMENT_COMPLETE_TYPE>(i_source));
184 template <
typename ELEMENT_COMPLETE_TYPE,
typename... CONSTRUCTION_PARAMS>
185 void emplace(CONSTRUCTION_PARAMS &&... i_construction_params)
187 m_queue.template emplace<ELEMENT_COMPLETE_TYPE>(
188 std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
198 template <
typename ELEMENT_TYPE>
202 return m_queue.
start_push(std::forward<ELEMENT_TYPE>(i_source));
213 template <
typename ELEMENT_TYPE,
typename... CONSTRUCTION_PARAMS>
216 return m_queue.template start_emplace<ELEMENT_TYPE>(
217 std::forward<ELEMENT_TYPE>(i_construction_params)...);
225 template <
typename ELEMENT_COMPLETE_TYPE>
228 m_queue.
reentrant_push(std::forward<ELEMENT_COMPLETE_TYPE>(i_source));
238 template <
typename ELEMENT_COMPLETE_TYPE,
typename... CONSTRUCTION_PARAMS>
241 m_queue.template reentrant_emplace<ELEMENT_COMPLETE_TYPE>(
242 std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
252 template <
typename ELEMENT_TYPE>
267 template <
typename ELEMENT_TYPE,
typename... CONSTRUCTION_PARAMS>
271 return m_queue.template start_reentrant_emplace<ELEMENT_TYPE>(
272 std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
280 template <
typename ELEMENT_COMPLETE_TYPE>
283 ELEMENT_COMPLETE_TYPE &&
284 i_source) noexcept(noexcept(m_queue
286 i_progress_guarantee,
287 std::forward<ELEMENT_COMPLETE_TYPE>(i_source))))
290 i_progress_guarantee, std::forward<ELEMENT_COMPLETE_TYPE>(i_source));
300 template <
typename ELEMENT_COMPLETE_TYPE,
typename... CONSTRUCTION_PARAMS>
303 noexcept(m_queue.template
try_emplace<ELEMENT_COMPLETE_TYPE>(
304 i_progress_guarantee,
std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...)))
306 return m_queue.template try_emplace<ELEMENT_COMPLETE_TYPE>(
307 i_progress_guarantee, std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
317 template <
typename ELEMENT_TYPE>
320 ELEMENT_TYPE && i_source) noexcept(noexcept(m_queue
322 i_progress_guarantee,
323 std::forward<ELEMENT_TYPE>(i_source))))
326 i_progress_guarantee, std::forward<ELEMENT_TYPE>(i_source));
337 template <
typename ELEMENT_TYPE,
typename... CONSTRUCTION_PARAMS>
340 CONSTRUCTION_PARAMS &&... i_construction_params) noexcept(noexcept(m_queue
343 i_progress_guarantee,
346 i_construction_params)...)))
348 return m_queue.template try_start_emplace<ELEMENT_TYPE>(
349 i_progress_guarantee, std::forward<ELEMENT_TYPE>(i_construction_params)...);
357 template <
typename ELEMENT_COMPLETE_TYPE>
360 ELEMENT_COMPLETE_TYPE &&
361 i_source) noexcept(noexcept(m_queue
363 i_progress_guarantee,
364 std::forward<ELEMENT_COMPLETE_TYPE>(i_source))))
367 i_progress_guarantee, std::forward<ELEMENT_COMPLETE_TYPE>(i_source));
377 template <
typename ELEMENT_COMPLETE_TYPE,
typename... CONSTRUCTION_PARAMS>
380 CONSTRUCTION_PARAMS &&... i_construction_params) noexcept(noexcept(m_queue
382 ELEMENT_COMPLETE_TYPE>(
383 i_progress_guarantee,
385 CONSTRUCTION_PARAMS>(
386 i_construction_params)...)))
388 return m_queue.template try_reentrant_emplace<ELEMENT_COMPLETE_TYPE>(
389 i_progress_guarantee, std::forward<CONSTRUCTION_PARAMS>(i_construction_params)...);
399 template <
typename ELEMENT_TYPE>
402 ELEMENT_TYPE && i_source) noexcept(noexcept(m_queue
404 i_progress_guarantee,
405 std::forward<ELEMENT_TYPE>(i_source))))
408 i_progress_guarantee, std::forward<ELEMENT_TYPE>(i_source));
419 template <
typename ELEMENT_TYPE,
typename... CONSTRUCTION_PARAMS>
422 CONSTRUCTION_PARAMS &&... i_construction_params) noexcept(noexcept(m_queue
425 i_progress_guarantee,
428 i_construction_params)...)))
430 return m_queue.template try_start_reentrant_emplace<ELEMENT_TYPE>(
431 i_progress_guarantee, std::forward<ELEMENT_TYPE>(i_construction_params)...);
449 typename std::conditional<std::is_void<RET_VAL>::value, bool,
optional<RET_VAL>>::type
452 return try_consume_impl(std::is_void<RET_VAL>(), std::forward<PARAMS>(i_params)...);
475 typename std::conditional<std::is_void<RET_VAL>::value, bool,
optional<RET_VAL>>::type
478 return try_consume_impl_cached(
479 std::is_void<RET_VAL>(), i_consume, std::forward<PARAMS>(i_params)...);
496 typename std::conditional<std::is_void<RET_VAL>::value, bool,
optional<RET_VAL>>::type
499 return try_reentrant_consume_impl(
500 std::is_void<RET_VAL>(), std::forward<PARAMS>(i_params)...);
522 typename std::conditional<std::is_void<RET_VAL>::value, bool,
optional<RET_VAL>>::type
525 return try_reentrant_consume_impl_cached(
526 std::is_void<RET_VAL>(), i_consume, std::forward<PARAMS>(i_params)...);
538 typename std::enable_if<ERASURE_ != function_manual_clear>::type * =
nullptr>
541 auto erasure = ERASURE;
561 auto && result = cons.complete_type().align_invoke_destroy(
562 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
563 cons.commit_nodestroy();
573 bool try_consume_impl(std::true_type, PARAMS... i_params)
577 cons.complete_type().align_invoke_destroy(
578 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
579 cons.commit_nodestroy();
594 auto && result = i_consume.complete_type().align_invoke_destroy(
595 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
596 i_consume.commit_nodestroy();
607 try_consume_impl_cached(std::true_type,
consume_operation & i_consume, PARAMS... i_params)
611 i_consume.complete_type().align_invoke_destroy(
612 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
613 i_consume.commit_nodestroy();
623 optional<RET_VAL> try_reentrant_consume_impl(std::false_type, PARAMS... i_params)
627 auto && result = cons.complete_type().align_invoke_destroy(
628 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
629 cons.commit_nodestroy();
639 bool try_reentrant_consume_impl(std::true_type, PARAMS... i_params)
643 cons.complete_type().align_invoke_destroy(
644 cons.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
645 cons.commit_nodestroy();
660 auto && result = i_consume.complete_type().align_invoke_destroy(
661 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
662 i_consume.commit_nodestroy();
672 bool try_reentrant_consume_impl_cached(
677 i_consume.complete_type().align_invoke_destroy(
678 i_consume.unaligned_element_ptr(), std::forward<PARAMS>(i_params)...);
679 i_consume.commit_nodestroy();
lf_function_queue() noexcept=default
std::conditional< std::is_void< RET_VAL >::value, bool, optional< RET_VAL > >::type try_consume(consume_operation &i_consume, PARAMS...i_params)
Definition: lf_function_queue.h:476
Definition: density_common.h:70
put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_push(ELEMENT_TYPE &&i_source)
Definition: lf_function_queue.h:200
Definition: lf_function_queue.h:20
reentrant_consume_operation try_start_reentrant_consume() noexcept
Definition: lf_heter_queue.h:3160
basic_default_allocator< default_page_capacity > default_allocator
Definition: default_allocator.h:152
void push(ELEMENT_TYPE &&i_source)
Definition: lf_heter_queue.h:1085
concurrency_cardinality
Definition: density_common.h:56
Definition: conc_function_queue.h:11
typename UnderlyingQueue::template put_transaction< ELEMENT_COMPLETE_TYPE > put_transaction
Definition: lf_function_queue.h:152
std::conditional< std::is_void< RET_VAL >::value, bool, optional< RET_VAL > >::type try_reentrant_consume(PARAMS...i_params)
Definition: lf_function_queue.h:497
typename UnderlyingQueue::consume_operation consume_operation
Definition: lf_function_queue.h:160
friend void swap(lf_function_queue &i_first, lf_function_queue &i_second) noexcept
Definition: lf_function_queue.h:133
static constexpr bool concurrent_put_consumes
Definition: lf_function_queue.h:110
Definition: density_common.h:60
Definition: runtime_type.h:1061
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: lf_function_queue.h:400
consume_operation try_start_consume() noexcept
Definition: lf_heter_queue.h:1923
put_transaction< typename std::decay< ELEMENT_TYPE >::type > try_start_push(progress_guarantee i_progress_guarantee, ELEMENT_TYPE &&i_source) noexcept(noexcept(std::declval< lf_heter_queue >() .template try_start_emplace< typename std::decay< ELEMENT_TYPE >::type >( i_progress_guarantee, std::forward< ELEMENT_TYPE >(i_source))))
Definition: lf_heter_queue.h:1618
put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_push(ELEMENT_TYPE &&i_source)
Definition: lf_heter_queue.h:1204
bool empty() const noexcept
Definition: lf_heter_queue.h:352
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< lf_heter_queue >() .template try_start_reentrant_emplace< typename std::decay< ELEMENT_TYPE >::type >( i_progress_guarantee, std::forward< ELEMENT_TYPE >(i_source))))
Definition: lf_heter_queue.h:2944
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: lf_function_queue.h:302
void reentrant_push(ELEMENT_COMPLETE_TYPE &&i_source)
Definition: lf_function_queue.h:226
#define DENSITY_ASSERT(...)
Definition: density_config.h:19
std::conditional< std::is_void< RET_VAL >::value, bool, optional< RET_VAL > >::type try_consume(PARAMS...i_params)
Definition: lf_function_queue.h:450
void emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: lf_function_queue.h:185
void push(ELEMENT_COMPLETE_TYPE &&i_source)
Definition: lf_function_queue.h:172
void clear() noexcept
Definition: lf_function_queue.h:539
reentrant_put_transaction< ELEMENT_TYPE > start_reentrant_emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: lf_function_queue.h:269
Definition: density_common.h:99
typename UnderlyingQueue::reentrant_consume_operation reentrant_consume_operation
Definition: lf_function_queue.h:163
static constexpr bool concurrent_consumes
Definition: lf_function_queue.h:106
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: lf_function_queue.h:378
progress_guarantee
Definition: density_common.h:84
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: lf_function_queue.h:318
static constexpr bool is_seq_cst
Definition: lf_function_queue.h:113
static constexpr bool concurrent_puts
Definition: lf_function_queue.h:103
Definition: density_common.h:101
put_transaction< ELEMENT_TYPE > start_emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: lf_function_queue.h:214
builtin_optional< TYPE > optional
Definition: density_config.h:218
bool empty() noexcept
Definition: lf_function_queue.h:553
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: lf_function_queue.h:338
reentrant_put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_reentrant_push(ELEMENT_TYPE &&i_source)
Definition: lf_function_queue.h:254
void reentrant_emplace(CONSTRUCTION_PARAMS &&...i_construction_params)
Definition: lf_function_queue.h:239
~lf_function_queue()
Definition: lf_function_queue.h:140
reentrant_put_transaction< typename std::decay< ELEMENT_TYPE >::type > start_reentrant_push(ELEMENT_TYPE &&i_source)
Definition: lf_heter_queue.h:2712
void clear() noexcept
Definition: lf_heter_queue.h:361
typename UnderlyingQueue::template reentrant_put_transaction< ELEMENT_COMPLETE_TYPE > reentrant_put_transaction
Definition: lf_function_queue.h:157
bool try_reentrant_push(progress_guarantee i_progress_guarantee, ELEMENT_TYPE &&i_source) noexcept(noexcept(std::declval< lf_heter_queue >() .template try_reentrant_emplace< typename std::decay< ELEMENT_TYPE >::type >( i_progress_guarantee, std::forward< ELEMENT_TYPE >(i_source))))
Definition: lf_heter_queue.h:2857
function_type_erasure
Definition: density_common.h:97
consistency_model
Definition: density_common.h:65
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: lf_function_queue.h:281
void reentrant_push(ELEMENT_TYPE &&i_source)
Definition: lf_heter_queue.h:2656
#define DENSITY_ASSUME(bool_expr,...)
Definition: density_config.h:46
bool try_push(progress_guarantee i_progress_guarantee, ELEMENT_TYPE &&i_source) noexcept( noexcept(std::declval< lf_heter_queue >() .template try_emplace< typename std::decay< ELEMENT_TYPE >::type >( i_progress_guarantee, std::forward< ELEMENT_TYPE >(i_source))))
Definition: lf_heter_queue.h:1430
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: lf_function_queue.h:358
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: lf_function_queue.h:420
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: lf_function_queue.h:523