set and clear session flags locked FS-3432

This commit is contained in:
Tamas Cseke 2012-05-24 11:16:26 +02:00
parent 4e6b56c53d
commit fdd3a8d333

View File

@ -592,7 +592,7 @@ static switch_status_t check_attached_sessions(listener_t *listener)
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delete", (const char *) key); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delete", (const char *) key);
continue; continue;
} }
switch_set_flag(sp, LFLAG_OUTBOUND_INIT); switch_set_flag_locked(sp, LFLAG_OUTBOUND_INIT);
} }
if (switch_test_flag(sp, LFLAG_SESSION_COMPLETE)) { if (switch_test_flag(sp, LFLAG_SESSION_COMPLETE)) {
@ -1278,8 +1278,7 @@ static switch_status_t state_handler(switch_core_session_t *session)
if (state == CS_DESTROY) { if (state == CS_DESTROY) {
/* indicate that once all the events in the event queue are done /* indicate that once all the events in the event queue are done
* we can throw this away */ * we can throw this away */
/* TODO locked? */ switch_set_flag_locked(session_element, LFLAG_SESSION_COMPLETE);
switch_set_flag(session_element, LFLAG_SESSION_COMPLETE);
} }
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to update channel state for %s to %s\n", switch_core_session_get_uuid(session), switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to update channel state for %s to %s\n", switch_core_session_get_uuid(session),
@ -1366,7 +1365,7 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul
spawn_reply_t *p; spawn_reply_t *p;
erlang_ref ref; erlang_ref ref;
switch_set_flag(session_element, LFLAG_WAITING_FOR_PID); switch_set_flag_locked(session_element, LFLAG_WAITING_FOR_PID);
/* attach the session to the listener */ /* attach the session to the listener */
add_session_elem_to_listener(listener, session_element); add_session_elem_to_listener(listener, session_element);
@ -1430,8 +1429,8 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul
memcpy(&session_element->process.pid, p->pid, sizeof(erlang_pid)); memcpy(&session_element->process.pid, p->pid, sizeof(erlang_pid));
session_element->spawn_reply = NULL; session_element->spawn_reply = NULL;
switch_clear_flag(session_element, LFLAG_OUTBOUND_INIT); switch_clear_flag_locked(session_element, LFLAG_OUTBOUND_INIT);
switch_clear_flag(session_element, LFLAG_WAITING_FOR_PID); switch_clear_flag_locked(session_element, LFLAG_WAITING_FOR_PID);
ei_link(listener, ei_self(listener->ec), &session_element->process.pid); ei_link(listener, ei_self(listener->ec), &session_element->process.pid);