* Pop the top proc from the resgroup wait queue and return it. */
| 2468 | * Pop the top proc from the resgroup wait queue and return it. |
| 2469 | */ |
| 2470 | static PGPROC * |
| 2471 | groupWaitQueuePop(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. |
no test coverage detected