MCPcopy Create free account
hub / github.com/apache/cloudberry / groupWaitQueuePop

Function groupWaitQueuePop

src/backend/utils/resgroup/resgroup.c:2470–2493  ·  view source on GitHub ↗

* Pop the top proc from the resgroup wait queue and return it. */

Source from the content-addressed store, hash-verified

2468 * Pop the top proc from the resgroup wait queue and return it.
2469 */
2470static PGPROC *
2471groupWaitQueuePop(ResGroupData *group)
2472{
2473 PROC_QUEUE *waitQueue;
2474 PGPROC *proc;
2475
2476 Assert(LWLockHeldByMeInMode(ResGroupLock, LW_EXCLUSIVE));
2477 Assert(!groupWaitQueueIsEmpty(group));
2478
2479 groupWaitQueueValidate(group);
2480
2481 waitQueue = &group->waitProcs;
2482
2483 proc = (PGPROC *) waitQueue->links.next;
2484 groupWaitProcValidate(proc, waitQueue);
2485 Assert(groupWaitQueueFind(group, proc));
2486 Assert(proc->resSlot == NULL);
2487
2488 SHMQueueDelete(&proc->links);
2489
2490 waitQueue->size--;
2491
2492 return proc;
2493}
2494
2495/*
2496 * Erase proc from the resgroup wait queue.

Callers 1

wakeupSlotsFunction · 0.85

Calls 6

LWLockHeldByMeInModeFunction · 0.85
groupWaitQueueIsEmptyFunction · 0.85
groupWaitQueueValidateFunction · 0.85
groupWaitProcValidateFunction · 0.85
groupWaitQueueFindFunction · 0.85
SHMQueueDeleteFunction · 0.85

Tested by

no test coverage detected