]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
avoiding deadlock (by not locking then locking again)
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 4 Jun 2008 23:15:57 +0000 (23:15 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 4 Jun 2008 23:15:57 +0000 (23:15 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8757 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_portaudio/mod_portaudio.c

index fad84e783467f937e3e471e2f2152b85f79e4748..6c67c4e6ac6e494a4ad12958597b26a5fc35c947 100644 (file)
@@ -1561,8 +1561,6 @@ SWITCH_STANDARD_API(pa_cmd)
                "pa ringdev #<num>|<partial name>\n" "--------------------------------------------------------------------------------\n";
 
 
-       switch_mutex_lock(globals.pa_mutex);
-
        if (stream->param_event) {
                http = switch_event_get_header(stream->param_event, "http-host");
        }
@@ -1679,7 +1677,11 @@ SWITCH_STANDARD_API(pa_cmd)
                if (http) {
                        stream->write_function(stream, "<pre>");
                }
+
+               switch_mutex_lock(globals.pa_mutex);
                status = func(&argv[lead], argc - lead, stream);
+               switch_mutex_unlock(globals.pa_mutex);
+
                if (http) {
                        stream->write_function(stream, "\n\n</pre>");
                }
@@ -1726,8 +1728,6 @@ SWITCH_STANDARD_API(pa_cmd)
                                                           "<td><input name=action type=submit value=\"D\"></td></tr>\n" "</table>" "</form><br></center></td></tr></table>\n");
        }
 
-       switch_mutex_lock(globals.pa_mutex);
-       
        switch_safe_free(mycmd);
        return status;
 }