MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / try_enqueue

Method try_enqueue

concurrentqueue.h:1076–1080  ·  view source on GitHub ↗

Enqueues a single item (by copying it). Does not allocate memory. Fails if not enough room to enqueue (or implicit production is disabled because Traits::INITIAL_IMPLICIT_PRODUCER_HASH_SIZE is 0). Note: If using only try_enqueue/try_enqueue_bulk with pre-allocated blocks, configure Traits::IMPLICIT_INITIAL_INDEX_SIZE appropriately to ensure the index has sufficient capacity for the number of block

Source from the content-addressed store, hash-verified

1074 // capacity for the number of blocks each producer may need.
1075 // Thread-safe.
1076 inline bool try_enqueue(T const& item)
1077 {
1078 MOODYCAMEL_CONSTEXPR_IF (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) return false;
1079 else return inner_enqueue<CannotAlloc>(item);
1080 }
1081
1082 // Enqueues a single item (by moving it, if possible).
1083 // Does not allocate memory (except for one-time implicit producer).

Callers 7

block_allocMethod · 0.45
block_recyclingMethod · 0.45
index_wrappingMethod · 0.45
subqueue_size_limitMethod · 0.45
full_apiMethod · 0.45
large_traitsMethod · 0.45

Calls 2

MOODYCAMEL_CONSTEXPR_IFFunction · 0.85
moveFunction · 0.85

Tested by 7

block_allocMethod · 0.36
block_recyclingMethod · 0.36
index_wrappingMethod · 0.36
subqueue_size_limitMethod · 0.36
full_apiMethod · 0.36
large_traitsMethod · 0.36