| 1211 | */ |
| 1212 | |
| 1213 | void wt_thd_release(WT_THD *thd, const WT_RESOURCE_ID *resid) |
| 1214 | { |
| 1215 | uint i; |
| 1216 | DBUG_ENTER("wt_thd_release"); |
| 1217 | |
| 1218 | for (i= 0; i < thd->my_resources.elements; i++) |
| 1219 | { |
| 1220 | WT_RESOURCE *rc= *dynamic_element(&thd->my_resources, i, WT_RESOURCE**); |
| 1221 | if (!resid || (resid->type->compare(&rc->id, resid) == 0)) |
| 1222 | { |
| 1223 | uint j; |
| 1224 | |
| 1225 | rc_wrlock(rc); |
| 1226 | /* |
| 1227 | nobody's trying to free the resource now, |
| 1228 | as its owners[] array is not empty (at least thd must be there) |
| 1229 | */ |
| 1230 | DBUG_ASSERT(rc->state == ACTIVE); |
| 1231 | for (j= 0; j < rc->owners.elements; j++) |
| 1232 | if (*dynamic_element(&rc->owners, j, WT_THD**) == thd) |
| 1233 | break; |
| 1234 | DBUG_ASSERT(j < rc->owners.elements); |
| 1235 | delete_dynamic_element(&rc->owners, j); |
| 1236 | if (rc->owners.elements == 0) |
| 1237 | { |
| 1238 | mysql_cond_broadcast(&rc->cond); |
| 1239 | #ifndef DBUG_OFF |
| 1240 | if (rc->cond_mutex) |
| 1241 | mysql_mutex_assert_owner(rc->cond_mutex); |
| 1242 | #endif |
| 1243 | } |
| 1244 | unlock_lock_and_free_resource(thd, rc); |
| 1245 | if (resid) |
| 1246 | { |
| 1247 | delete_dynamic_element(&thd->my_resources, i); |
| 1248 | DBUG_VOID_RETURN; |
| 1249 | } |
| 1250 | } |
| 1251 | } |
| 1252 | if (!resid) |
| 1253 | reset_dynamic(&thd->my_resources); |
| 1254 | DBUG_VOID_RETURN; |
| 1255 | } |
| 1256 |
nothing calls this directly
no test coverage detected