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

Method add

tests/relacy/freelist.cpp:23–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 FreeList() : freeListHead(nullptr) { }
22
23 inline void add(N* node)
24 {
25 // We know that the should-be-on-freelist bit is 0 at this point, so it's safe to
26 // set it using a fetch_add
27 if (node->freeListRefs.fetch_add(SHOULD_BE_ON_FREELIST, std::memory_order_acq_rel) == 0) {
28 // Oh look! We were the last ones referencing this node, and we know
29 // we want to add it to the free list, so let's do it!
30 add_knowing_refcount_is_zero(node);
31 }
32 }
33
34 inline N* try_get()
35 {

Callers 5

threadMethod · 0.45
threadMethod · 0.45
run_testFunction · 0.45
core_add_only_listMethod · 0.45
core_free_listMethod · 0.45

Calls 1

fetch_addMethod · 0.45

Tested by 3

run_testFunction · 0.36
core_add_only_listMethod · 0.36
core_free_listMethod · 0.36