]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Some more tweaks
authorAndrew Thompson <andrew@hijacked.us>
Mon, 23 Aug 2010 00:46:04 +0000 (20:46 -0400)
committerAndrew Thompson <andrew@hijacked.us>
Mon, 23 Aug 2010 00:58:52 +0000 (20:58 -0400)
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

index 79a5d64878b260d4b333cb1b323e7ca7e2e29d42..848a2c58ea1ccdeee45adc51b0feafef83a15e85 100644 (file)
@@ -1258,7 +1258,7 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul
 
        p = switch_core_alloc(session_element->pool, sizeof(*p));
        switch_thread_cond_create(&p->ready_or_found, session_element->pool);
-       switch_mutex_init(&p->mutex, SWITCH_MUTEX_DEFAULT, session_element->pool);
+       switch_mutex_init(&p->mutex, SWITCH_MUTEX_UNNESTED, session_element->pool);
        p->state = reply_not_ready;
        p->hash = hash;
        p->pid = NULL;
@@ -1266,6 +1266,7 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul
        session_element->spawn_reply = p;
 
        switch_mutex_lock(p->mutex);
+       p->state = reply_waiting;
 
        if (!strcmp(function, "!")) {
                /* send a message to request a pid */
@@ -1295,8 +1296,6 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul
                 */
        }
 
-       p->state = reply_waiting;
-       switch_thread_cond_broadcast(p->ready_or_found);
        switch_thread_cond_timedwait(p->ready_or_found,
                        p->mutex, 5000000);
        if (!p->pid) {