From 47f997a05030133c4a406d3ad4709121be8a9904 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 16 Aug 2011 13:26:43 -0500 Subject: [PATCH] back off locking contention so you can query for other interfaces while a module is loading that locks the interfaces hash --- src/switch_loadable_module.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 8fca52eb58..007309781e 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -994,8 +994,8 @@ static switch_status_t switch_loadable_module_load_module_ex(char *dir, char *fn switch_snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext); } - switch_mutex_lock(loadable_modules.mutex); - if (switch_core_hash_find(loadable_modules.module_hash, file)) { + + if (switch_core_hash_find_locked(loadable_modules.module_hash, file, loadable_modules.mutex)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Module %s Already Loaded!\n", file); *err = "Module already loaded"; status = SWITCH_STATUS_FALSE; @@ -1010,7 +1010,7 @@ static switch_status_t switch_loadable_module_load_module_ex(char *dir, char *fn } else { *err = "module load file routine returned an error"; } - switch_mutex_unlock(loadable_modules.mutex); + return status;