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

Function intern_plugin_lock

sql/sql_plugin.cc:975–1018  ·  view source on GitHub ↗

If LEX is passed non-NULL, an automatic unlock of the plugin will happen in the LEX destructor. */

Source from the content-addressed store, hash-verified

973 in the LEX destructor.
974*/
975static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc,
976 uint state_mask= PLUGIN_IS_READY |
977 PLUGIN_IS_UNINITIALIZED |
978 PLUGIN_IS_DELETED)
979{
980 st_plugin_int *pi= plugin_ref_to_int(rc);
981 DBUG_ENTER("intern_plugin_lock");
982
983 mysql_mutex_assert_owner(&LOCK_plugin);
984
985 if (pi->state & state_mask)
986 {
987 plugin_ref plugin;
988#ifdef DBUG_OFF
989 /*
990 In optimized builds we don't do reference counting for built-in
991 (plugin->plugin_dl == 0) plugins.
992 */
993 if (!pi->plugin_dl)
994 DBUG_RETURN(pi);
995
996 plugin= pi;
997#else
998 /*
999 For debugging, we do an additional malloc which allows the
1000 memory manager and/or valgrind to track locked references and
1001 double unlocks to aid resolving reference counting problems.
1002 */
1003 if (!(plugin= (plugin_ref) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(pi),
1004 MYF(MY_WME))))
1005 DBUG_RETURN(NULL);
1006
1007 *plugin= pi;
1008#endif
1009 pi->ref_count++;
1010 DBUG_PRINT("lock",("thd: %p plugin: \"%s\" LOCK ref_count: %d",
1011 current_thd, pi->name.str, pi->ref_count));
1012
1013 if (lex)
1014 insert_dynamic(&lex->plugins, (uchar*)&plugin);
1015 DBUG_RETURN(plugin);
1016 }
1017 DBUG_RETURN(NULL);
1018}
1019
1020
1021/*

Callers 6

plugin_lockFunction · 0.85
plugin_lock_by_nameFunction · 0.85
plugin_initFunction · 0.85
plugin_foreach_with_maskFunction · 0.85
find_sys_varFunction · 0.85
plugin_thdvar_initFunction · 0.85

Calls 2

my_mallocFunction · 0.85
insert_dynamicFunction · 0.85

Tested by

no test coverage detected