* GetResQueueFromLock -- find the resource queue for a given lock; * * Notes: * should be handed a locktag containing a valid queue id. * should hold the resource queue lightweight lock during this operation */
| 1099 | * should hold the resource queue lightweight lock during this operation |
| 1100 | */ |
| 1101 | ResQueue |
| 1102 | GetResQueueFromLock(LOCK *lock) |
| 1103 | { |
| 1104 | Assert(LWLockHeldByMe(ResQueueLock)); |
| 1105 | |
| 1106 | ResQueue queue = ResQueueHashFind(GET_RESOURCE_QUEUEID_FOR_LOCK(lock)); |
| 1107 | |
| 1108 | if (queue == NULL) |
| 1109 | { |
| 1110 | elog(ERROR, "cannot find queue id %d", GET_RESOURCE_QUEUEID_FOR_LOCK(lock)); |
| 1111 | } |
| 1112 | |
| 1113 | return queue; |
| 1114 | } |
| 1115 | |
| 1116 | /* |
| 1117 | * ResGrantLock -- grant a resource lock. |
no test coverage detected