]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Revert "FS-10299 [mod_callcenter] Removing global lock on all cc_execute_sql function...
authorAntonio <asilva@wirelessmundi.com>
Fri, 23 Jun 2017 17:02:39 +0000 (19:02 +0200)
committerMike Jerris <mike@jerris.com>
Tue, 11 Jul 2017 17:10:11 +0000 (13:10 -0400)
This reverts commit faf87febdb5a90f7c339df6934fd7eb04c927b67.

src/mod/applications/mod_callcenter/mod_callcenter.c

index b02926f9b6d5a391f29f815162a01b312bdadc2b..47e419380c85347c7b8abba33d5e1f0acfdc1e7a 100644 (file)
@@ -587,6 +587,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())) {
@@ -601,6 +603,8 @@ end:
 
        if (mutex) {
                switch_mutex_unlock(mutex);
+       } else {
+               switch_mutex_unlock(globals.mutex);
        }
 
        return ret;
@@ -613,6 +617,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())) {
@@ -628,6 +634,8 @@ end:
 
        if (mutex) {
                switch_mutex_unlock(mutex);
+       } else {
+               switch_mutex_unlock(globals.mutex);
        }
 
        return status;
@@ -641,6 +649,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())) {
@@ -661,6 +671,8 @@ end:
 
        if (mutex) {
                switch_mutex_unlock(mutex);
+       } else {
+               switch_mutex_unlock(globals.mutex);
        }
 
        return ret;