]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fix erlang deadlock
authorTamas Cseke <tamas.cseke@virtual-call-center.eu>
Tue, 20 May 2014 08:13:38 +0000 (10:13 +0200)
committerTamas Cseke <tamas.cseke@virtual-call-center.eu>
Tue, 20 May 2014 08:13:38 +0000 (10:13 +0200)
Release session R/W Lock

src/mod/event_handlers/mod_erlang_event/handle_msg.c

index af287189821d690474555193dc8d75954746b5a8..0302a320f49448f694f298fa358bd67d7171f248 100644 (file)
@@ -358,6 +358,7 @@ static switch_status_t handle_msg_session_event(listener_t *listener, erlang_msg
                        }
 
                        switch_thread_rwlock_unlock(session->event_rwlock);
+                       switch_thread_rwlock_unlock(session->rwlock);
                        
                        ei_x_encode_atom(rbuf, "ok");
                } else {
@@ -462,6 +463,7 @@ static switch_status_t handle_msg_session_nixevent(listener_t *listener, erlang_
                                }
                        }
                        switch_thread_rwlock_unlock(session->event_rwlock);
+                       switch_thread_rwlock_unlock(session->rwlock);
 
                        ei_x_encode_atom(rbuf, "ok");
                } else { /* no session for this pid */
@@ -594,6 +596,8 @@ static switch_status_t handle_msg_session_setevent(listener_t *listener, erlang_
                        session->event_hash = event_hash;
                        switch_thread_rwlock_unlock(session->event_rwlock);
 
+                       switch_thread_rwlock_unlock(session->rwlock);
+
                        /* TODO - we should flush any non-matching events from the queue */
                        ei_x_encode_atom(rbuf, "ok");
                } else { /* no session for this pid */
@@ -1076,6 +1080,8 @@ static switch_status_t handle_msg_atom(listener_t *listener, erlang_msg * msg, e
                        switch_core_hash_delete_multi(session->event_hash, NULL, NULL);
                        switch_thread_rwlock_unlock(session->event_rwlock);
 
+                       switch_thread_rwlock_unlock(session->rwlock);
+
                        ei_x_encode_atom(rbuf, "ok");
                } else {
                        ei_x_encode_tuple_header(rbuf, 2);