in src/clds_hazard_pointers.c [624:657]
void clds_hazard_pointers_reclaim(CLDS_HAZARD_POINTERS_THREAD_HANDLE clds_hazard_pointers_thread, void* node, RECLAIM_FUNC reclaim_func)
{
if (
(clds_hazard_pointers_thread == NULL) ||
(node == NULL)
)
{
LogError("Invalid arguments: CLDS_HAZARD_POINTERS_THREAD_HANDLE clds_hazard_pointers_thread=%p, void* node=%p, RECLAIM_FUNC reclaim_func=%p",
clds_hazard_pointers_thread, node, reclaim_func);
}
else
{
CLDS_RECLAIM_LIST_ENTRY* reclaim_list_entry = malloc(sizeof(CLDS_RECLAIM_LIST_ENTRY));
if (reclaim_list_entry == NULL)
{
// oops, panic now!
LogError("Cannot allocate reclaim list entry");
}
else
{
reclaim_list_entry->next = clds_hazard_pointers_thread->reclaim_list;
reclaim_list_entry->node = node;
reclaim_list_entry->reclaim = reclaim_func;
// add the pointer to the reclaim list, no other thread has access to this list, so no interlocked needed
clds_hazard_pointers_thread->reclaim_list = reclaim_list_entry;
clds_hazard_pointers_thread->reclaim_list_entry_count++;
if (clds_hazard_pointers_thread->reclaim_list_entry_count >= clds_hazard_pointers_thread->clds_hazard_pointers->reclaim_threshold)
{
internal_reclaim(clds_hazard_pointers_thread);
}
}
}
}