diff --git a/src/snmalloc/mem/corealloc.h b/src/snmalloc/mem/corealloc.h index 61fe580..e164f59 100644 --- a/src/snmalloc/mem/corealloc.h +++ b/src/snmalloc/mem/corealloc.h @@ -450,19 +450,25 @@ namespace snmalloc */ SNMALLOC_FAST_PATH bool has_messages() { - auto domesticate = [local_state = backend_state_ptr()]( - freelist::QueuePtr p) SNMALLOC_FAST_PATH_LAMBDA { - if constexpr (Config::Options.QueueHeadsAreTame) - { - return freelist::HeadPtr::unsafe_from(p.unsafe_ptr()); - } - else - { + auto local_state = backend_state_ptr(); + auto domesticate_head = + [local_state](freelist::QueuePtr p) SNMALLOC_FAST_PATH_LAMBDA { + if constexpr (Config::Options.QueueHeadsAreTame) + { + UNUSED(local_state); + return freelist::HeadPtr::unsafe_from(p.unsafe_ptr()); + } + else + { + return capptr_domesticate(local_state, p); + } + }; + auto domesticate_queue = + [local_state](freelist::QueuePtr p) SNMALLOC_FAST_PATH_LAMBDA { return capptr_domesticate(local_state, p); - } - }; + }; - return message_queue().can_dequeue(domesticate); + return message_queue().can_dequeue(domesticate_head, domesticate_queue); } /** diff --git a/src/snmalloc/mem/remoteallocator.h b/src/snmalloc/mem/remoteallocator.h index e3c45bc..f441d1a 100644 --- a/src/snmalloc/mem/remoteallocator.h +++ b/src/snmalloc/mem/remoteallocator.h @@ -87,11 +87,12 @@ namespace snmalloc return fnt; } - template - inline bool can_dequeue(Domesticator_head domesticate_head) + template + inline bool can_dequeue( + Domesticator_head domesticate_head, Domesticator_queue domesticate_queue) { return domesticate_head(front.load()) - ->atomic_read_next(key_global, domesticate_head) != nullptr; + ->atomic_read_next(key_global, domesticate_queue) != nullptr; } /**