MCPcopy Create free account
hub / github.com/MariaDB/server / reap_plugins

Function reap_plugins

sql/sql_plugin.cc:1320–1362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1318}
1319
1320static 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
1364static void intern_plugin_unlock(LEX *lex, plugin_ref plugin)
1365{

Callers 6

plugin_unlockFunction · 0.85
plugin_unlock_listFunction · 0.85
plugin_shutdownFunction · 0.85
mysql_install_pluginFunction · 0.85
mysql_uninstall_pluginFunction · 0.85
plugin_thdvar_cleanupFunction · 0.85

Calls 3

my_hash_elementFunction · 0.85
plugin_deinitializeFunction · 0.85
plugin_delFunction · 0.85

Tested by

no test coverage detected