| 1118 | |
| 1119 | |
| 1120 | static 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 | } |
no test coverage detected