From 04854fddaa1548e5d57a90fad74a433bee7a0750 Mon Sep 17 00:00:00 2001 From: Antonio Date: Fri, 23 Jun 2017 19:02:39 +0200 Subject: [PATCH] Revert "FS-10299 [mod_callcenter] Removing global lock on all cc_execute_sql functions when executing database queries" This reverts commit faf87febdb5a90f7c339df6934fd7eb04c927b67. --- src/mod/applications/mod_callcenter/mod_callcenter.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 656af706eb..7c45d6eaf3 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -601,6 +601,8 @@ char *cc_execute_sql2str(cc_queue_t *queue, switch_mutex_t *mutex, char *sql, ch if (mutex) { switch_mutex_lock(mutex); + } else { + switch_mutex_lock(globals.mutex); } if (!(dbh = cc_get_db_handle())) { @@ -615,6 +617,8 @@ end: if (mutex) { switch_mutex_unlock(mutex); + } else { + switch_mutex_unlock(globals.mutex); } return ret; @@ -627,6 +631,8 @@ static switch_status_t cc_execute_sql(cc_queue_t *queue, char *sql, switch_mutex if (mutex) { switch_mutex_lock(mutex); + } else { + switch_mutex_lock(globals.mutex); } if (!(dbh = cc_get_db_handle())) { @@ -642,6 +648,8 @@ end: if (mutex) { switch_mutex_unlock(mutex); + } else { + switch_mutex_unlock(globals.mutex); } return status; @@ -655,6 +663,8 @@ static switch_bool_t cc_execute_sql_callback(cc_queue_t *queue, switch_mutex_t * if (mutex) { switch_mutex_lock(mutex); + } else { + switch_mutex_lock(globals.mutex); } if (!(dbh = cc_get_db_handle())) { @@ -675,6 +685,8 @@ end: if (mutex) { switch_mutex_unlock(mutex); + } else { + switch_mutex_unlock(globals.mutex); } return ret;