mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 10:33:13 +00:00
Take two, using find_resource on Kevin's suggestion.
Might need better locking support, giving up if we can't get the lock. Right now, using existing locking in find_resource git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -871,23 +871,17 @@ int ast_update_module_list(int (*modentry)(const char *module, const char *descr
|
|||||||
return total_mod_loaded;
|
return total_mod_loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \brief Check if module exists */
|
||||||
int ast_module_check(char *name)
|
int ast_module_check(char *name)
|
||||||
{
|
{
|
||||||
struct ast_module *cur;
|
struct ast_module *cur;
|
||||||
int unlock = -1;
|
|
||||||
int res = 0;
|
|
||||||
|
|
||||||
if (ast_strlen_zero(name))
|
if (ast_strlen_zero(name))
|
||||||
return 0; /* FALSE */
|
return 0; /* FALSE */
|
||||||
|
|
||||||
if (ast_mutex_trylock(&module_list.lock))
|
cur = find_resource(name, 1);
|
||||||
unlock = 0;
|
|
||||||
AST_LIST_TRAVERSE(&module_list, cur, entry)
|
return (cur != NULL);
|
||||||
if (!res && !strcasecmp(name, cur->resource))
|
|
||||||
res = 1;
|
|
||||||
if (unlock)
|
|
||||||
AST_LIST_UNLOCK(&module_list);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user