refactor: priority_queue_grow_nolock

master
Sean McBride 3 years ago
parent 8a170e1a64
commit 3b92963868

@ -288,11 +288,14 @@ priority_queue_initialize(size_t capacity, bool use_lock, priority_queue_get_pri
/**
* Double capacity of priority queue
* Note: currently there is no equivalent call for PQs that are not thread-local and need to be locked because it is
* unclear if the fact that the lock is a member in the struct that might be moved by realloc breaks the guarantees of
* the lock.
* @param priority_queue to resize
* @returns pointer to PR. This may have been moved by realloc!
*/
static inline struct priority_queue *
priority_queue_grow(struct priority_queue *priority_queue)
priority_queue_grow_nolock(struct priority_queue *priority_queue)
{
assert(priority_queue != NULL);

@ -37,7 +37,7 @@ local_runqueue_minheap_add(struct sandbox *sandbox)
{
int return_code = priority_queue_enqueue_nolock(local_runqueue_minheap, sandbox);
if (unlikely(return_code == -ENOSPC)) {
local_runqueue_minheap = priority_queue_grow(local_runqueue_minheap);
local_runqueue_minheap = priority_queue_grow_nolock(local_runqueue_minheap);
return_code = priority_queue_enqueue_nolock(local_runqueue_minheap, sandbox);
if (unlikely(return_code == -ENOSPC)) panic("Thread Runqueue is full!\n");
}

Loading…
Cancel
Save