| 1307 | |
| 1308 | |
| 1309 | static USHORT internal_downgrade(thread_db* tdbb, CheckStatusWrapper* statusVector, Lock* first) |
| 1310 | { |
| 1311 | /************************************** |
| 1312 | * |
| 1313 | * i n t e r n a l _ d o w n g r a d e |
| 1314 | * |
| 1315 | ************************************** |
| 1316 | * |
| 1317 | * Functional description |
| 1318 | * Set the physical lock value of all locks identical |
| 1319 | * to the passed lock. It should be the same as the |
| 1320 | * highest logical level. |
| 1321 | * |
| 1322 | **************************************/ |
| 1323 | SET_TDBB(tdbb); |
| 1324 | Database* const dbb = tdbb->getDatabase(); |
| 1325 | |
| 1326 | fb_assert(LCK_CHECK_LOCK(first)); |
| 1327 | fb_assert(first->lck_compatible); |
| 1328 | |
| 1329 | // find the highest required lock level |
| 1330 | |
| 1331 | USHORT level = LCK_none; |
| 1332 | for (const Lock* lock = first; lock; lock = lock->lck_identical) |
| 1333 | level = MAX(level, lock->lck_logical); |
| 1334 | |
| 1335 | // if we can convert to that level, set all identical locks as having that level |
| 1336 | |
| 1337 | if (level < first->lck_physical) |
| 1338 | { |
| 1339 | if (dbb->lockManager()->convert(tdbb, statusVector, first->lck_id, level, LCK_NO_WAIT, |
| 1340 | external_ast, first)) |
| 1341 | { |
| 1342 | for (Lock* lock = first; lock; lock = lock->lck_identical) |
| 1343 | { |
| 1344 | lock->lck_physical = level; |
| 1345 | } |
| 1346 | |
| 1347 | return level; |
| 1348 | } |
| 1349 | } |
| 1350 | |
| 1351 | return first->lck_physical; |
| 1352 | } |
| 1353 | |
| 1354 | |
| 1355 | static bool internal_enqueue(thread_db* tdbb, CheckStatusWrapper* statusVector, Lock* lock, |
no test coverage detected