| 1221 | |
| 1222 | |
| 1223 | static bool internal_compatible(Lock* match, const Lock* lock, USHORT level) |
| 1224 | { |
| 1225 | /************************************** |
| 1226 | * |
| 1227 | * i n t e r n a l _ c o m p a t i b l e |
| 1228 | * |
| 1229 | ************************************** |
| 1230 | * |
| 1231 | * Functional description |
| 1232 | * See if there are any incompatible locks |
| 1233 | * in the list of locks held by this process. |
| 1234 | * If there are none, return true to indicate |
| 1235 | * that the lock is compatible. |
| 1236 | * |
| 1237 | **************************************/ |
| 1238 | fb_assert(LCK_CHECK_LOCK(match)); |
| 1239 | fb_assert(LCK_CHECK_LOCK(lock)); |
| 1240 | |
| 1241 | // first check if there are any locks which are incompatible which do not have blocking asts; |
| 1242 | // if so, there is no chance of getting a compatible lock |
| 1243 | |
| 1244 | for (const Lock* next = match; next; next = next->lck_identical) |
| 1245 | { |
| 1246 | if (!next->lck_ast && !compatible(next, lock, level)) |
| 1247 | return false; |
| 1248 | } |
| 1249 | |
| 1250 | // now deliver the blocking asts, attempting to gain |
| 1251 | // compatibility by getting everybody to downgrade |
| 1252 | internal_ast(match); |
| 1253 | |
| 1254 | // make one more pass to see if all locks were downgraded |
| 1255 | |
| 1256 | for (const Lock* next = match; next; next = next->lck_identical) |
| 1257 | { |
| 1258 | if (!compatible(next, match, level)) |
| 1259 | return false; |
| 1260 | } |
| 1261 | |
| 1262 | return true; |
| 1263 | } |
| 1264 | |
| 1265 | |
| 1266 | static void internal_dequeue(thread_db* tdbb, Lock* lock) |
no test coverage detected