mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-21 09:10:36 +00:00
sla: remove redundant locking.
sla.lock was already locked in the only place that sla_check_reload() was called. Remove the redundant locking of sla.lock done in this function. Less recursive locking is A Good Thing. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -6437,17 +6437,18 @@ static int sla_process_timers(struct timespec *ts)
|
|||||||
|
|
||||||
static int sla_load_config(int reload);
|
static int sla_load_config(int reload);
|
||||||
|
|
||||||
/*! \brief Check if we can do a reload of SLA, and do it if we can */
|
/*!
|
||||||
|
* \internal
|
||||||
|
* \brief Check if we can do a reload of SLA, and do it if we can
|
||||||
|
* \pre sla.lock is locked.
|
||||||
|
*/
|
||||||
static void sla_check_reload(void)
|
static void sla_check_reload(void)
|
||||||
{
|
{
|
||||||
struct sla_station *station;
|
struct sla_station *station;
|
||||||
struct sla_trunk *trunk;
|
struct sla_trunk *trunk;
|
||||||
|
|
||||||
ast_mutex_lock(&sla.lock);
|
|
||||||
|
|
||||||
if (!AST_LIST_EMPTY(&sla.event_q) || !AST_LIST_EMPTY(&sla.ringing_trunks)
|
if (!AST_LIST_EMPTY(&sla.event_q) || !AST_LIST_EMPTY(&sla.ringing_trunks)
|
||||||
|| !AST_LIST_EMPTY(&sla.ringing_stations)) {
|
|| !AST_LIST_EMPTY(&sla.ringing_stations)) {
|
||||||
ast_mutex_unlock(&sla.lock);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6458,7 +6459,6 @@ static void sla_check_reload(void)
|
|||||||
}
|
}
|
||||||
AST_RWLIST_UNLOCK(&sla_stations);
|
AST_RWLIST_UNLOCK(&sla_stations);
|
||||||
if (station) {
|
if (station) {
|
||||||
ast_mutex_unlock(&sla.lock);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6469,15 +6469,12 @@ static void sla_check_reload(void)
|
|||||||
}
|
}
|
||||||
AST_RWLIST_UNLOCK(&sla_trunks);
|
AST_RWLIST_UNLOCK(&sla_trunks);
|
||||||
if (trunk) {
|
if (trunk) {
|
||||||
ast_mutex_unlock(&sla.lock);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* yay */
|
/* yay */
|
||||||
sla_load_config(1);
|
sla_load_config(1);
|
||||||
sla.reload = 0;
|
sla.reload = 0;
|
||||||
|
|
||||||
ast_mutex_unlock(&sla.lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *sla_thread(void *data)
|
static void *sla_thread(void *data)
|
||||||
|
|||||||
Reference in New Issue
Block a user