| 1264 | |
| 1265 | |
| 1266 | static void internal_dequeue(thread_db* tdbb, Lock* lock) |
| 1267 | { |
| 1268 | /************************************** |
| 1269 | * |
| 1270 | * i n t e r n a l _ d e q u e u e |
| 1271 | * |
| 1272 | ************************************** |
| 1273 | * |
| 1274 | * Functional description |
| 1275 | * Dequeue a lock. If there are identical |
| 1276 | * compatible locks, check to see whether |
| 1277 | * the lock needs to be downgraded. |
| 1278 | * |
| 1279 | **************************************/ |
| 1280 | SET_TDBB(tdbb); |
| 1281 | Database* const dbb = tdbb->getDatabase(); |
| 1282 | |
| 1283 | fb_assert(LCK_CHECK_LOCK(lock)); |
| 1284 | fb_assert(lock->lck_compatible); |
| 1285 | |
| 1286 | // if this is the last identical lock in the hash table, release it |
| 1287 | |
| 1288 | Lock* match; |
| 1289 | if (hash_remove_lock(lock, &match)) |
| 1290 | { |
| 1291 | if (!dbb->lockManager()->dequeue(lock->lck_id)) |
| 1292 | { |
| 1293 | bug_lck("LOCK_deq() failed in Lock:internal_dequeue"); |
| 1294 | } |
| 1295 | |
| 1296 | lock->lck_id = 0; |
| 1297 | lock->lck_physical = lock->lck_logical = LCK_none; |
| 1298 | return; |
| 1299 | } |
| 1300 | |
| 1301 | // check for a potential downgrade |
| 1302 | |
| 1303 | FbLocalStatus statusVector; |
| 1304 | internal_downgrade(tdbb, &statusVector, match); |
| 1305 | fb_assert(statusVector.isEmpty()); |
| 1306 | } |
| 1307 | |
| 1308 | |
| 1309 | static USHORT internal_downgrade(thread_db* tdbb, CheckStatusWrapper* statusVector, Lock* first) |
no test coverage detected