Notes on lifetime: If THD is passed as non-NULL (and with a non-NULL thd->lex), an entry is made in the thd->lex which will cause an automatic unlock of the plugin in the LEX destructor. In this case, no manual unlock must be done. Otherwise, when passing a NULL THD, the caller must arrange that plugin unlock happens later. */
| 1075 | unlock happens later. |
| 1076 | */ |
| 1077 | plugin_ref plugin_lock_by_name(THD *thd, const LEX_CSTRING *name, int type) |
| 1078 | { |
| 1079 | LEX *lex= thd ? thd->lex : 0; |
| 1080 | plugin_ref rc= NULL; |
| 1081 | st_plugin_int *plugin; |
| 1082 | DBUG_ENTER("plugin_lock_by_name"); |
| 1083 | if (!name->length) |
| 1084 | DBUG_RETURN(NULL); |
| 1085 | mysql_mutex_lock(&LOCK_plugin); |
| 1086 | if ((plugin= plugin_find_internal(name, type))) |
| 1087 | rc= intern_plugin_lock(lex, plugin_int_to_ref(plugin)); |
| 1088 | mysql_mutex_unlock(&LOCK_plugin); |
| 1089 | DBUG_RETURN(rc); |
| 1090 | } |
| 1091 | |
| 1092 | |
| 1093 | static st_plugin_int *plugin_insert_or_reuse(struct st_plugin_int *plugin) |
no test coverage detected