| 1318 | } |
| 1319 | |
| 1320 | static void reap_plugins(void) |
| 1321 | { |
| 1322 | size_t count; |
| 1323 | struct st_plugin_int *plugin, **reap, **list; |
| 1324 | |
| 1325 | mysql_mutex_assert_owner(&LOCK_plugin); |
| 1326 | |
| 1327 | if (!reap_needed) |
| 1328 | return; |
| 1329 | |
| 1330 | reap_needed= false; |
| 1331 | count= plugin_array.elements; |
| 1332 | reap= (struct st_plugin_int **)my_alloca(sizeof(plugin)*(count+1)); |
| 1333 | *(reap++)= NULL; |
| 1334 | |
| 1335 | for (uint i=0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++) |
| 1336 | { |
| 1337 | HASH *hash= plugin_hash + plugin_type_initialization_order[i]; |
| 1338 | for (uint j= 0; j < hash->records; j++) |
| 1339 | { |
| 1340 | plugin= (struct st_plugin_int *) my_hash_element(hash, j); |
| 1341 | if (plugin->state == PLUGIN_IS_DELETED && !plugin->ref_count) |
| 1342 | { |
| 1343 | /* change the status flag to prevent reaping by another thread */ |
| 1344 | plugin->state= PLUGIN_IS_DYING; |
| 1345 | *(reap++)= plugin; |
| 1346 | } |
| 1347 | } |
| 1348 | } |
| 1349 | |
| 1350 | mysql_mutex_unlock(&LOCK_plugin); |
| 1351 | |
| 1352 | list= reap; |
| 1353 | while ((plugin= *(--list))) |
| 1354 | plugin_deinitialize(plugin, true); |
| 1355 | |
| 1356 | mysql_mutex_lock(&LOCK_plugin); |
| 1357 | |
| 1358 | while ((plugin= *(--reap))) |
| 1359 | plugin_del(plugin, 0); |
| 1360 | |
| 1361 | my_afree(reap); |
| 1362 | } |
| 1363 | |
| 1364 | static void intern_plugin_unlock(LEX *lex, plugin_ref plugin) |
| 1365 | { |
no test coverage detected