MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / hash_remove_lock

Function hash_remove_lock

src/jrd/lck.cpp:1120–1181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1118
1119
1120static bool hash_remove_lock(Lock* lock, Lock** match)
1121{
1122/**************************************
1123 *
1124 * h a s h _ r e m o v e _ l o c k
1125 *
1126 **************************************
1127 *
1128 * Functional description
1129 * Remove the passed lock from the hash table.
1130 * Return true if this is the last such identical
1131 * lock removed. Also return the first matching
1132 * locking found.
1133 *
1134 **************************************/
1135 fb_assert(LCK_CHECK_LOCK(lock));
1136
1137 Lock** prior;
1138 Lock* next = hash_get_lock(lock, 0, &prior);
1139 if (!next)
1140 {
1141 // set lck_compatible to NULL to make sure we don't
1142 // try to release the lock again in bugchecking
1143
1144 lock->lck_compatible = NULL;
1145 BUGCHECK(285); // lock not found in internal lock manager
1146 }
1147
1148 if (match)
1149 *match = next;
1150
1151 // special case if our lock is the first one in the identical list
1152
1153 if (next == lock)
1154 {
1155 if (lock->lck_identical)
1156 {
1157 lock->lck_identical->lck_collision = lock->lck_collision;
1158 *prior = lock->lck_identical;
1159 return false;
1160 }
1161
1162 *prior = lock->lck_collision;
1163 return true;
1164 }
1165
1166 Lock* last = 0;
1167 for (; next; last = next, next = next->lck_identical)
1168 {
1169 if (next == lock)
1170 break;
1171 }
1172
1173 if (!next)
1174 {
1175 lock->lck_compatible = NULL;
1176 BUGCHECK(285); // lock not found in internal lock manager
1177 }

Callers 1

internal_dequeueFunction · 0.85

Calls 1

hash_get_lockFunction · 0.85

Tested by

no test coverage detected