FSCORE-576

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@17065 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2010-03-22 16:22:19 +00:00
parent 4bf3f5c86f
commit b481cf0e21
3 changed files with 9 additions and 2 deletions

View File

@ -127,6 +127,7 @@ struct switch_core_session {
switch_mutex_t *codec_read_mutex;
switch_mutex_t *codec_write_mutex;
switch_thread_cond_t *cond;
switch_mutex_t *frame_read_mutex;
switch_thread_rwlock_t *rwlock;

View File

@ -308,7 +308,7 @@ SWITCH_DECLARE(char *) switch_core_get_uuid(void)
}
static void *switch_core_service_thread(switch_thread_t *thread, void *obj)
static void *SWITCH_THREAD_FUNC switch_core_service_thread(switch_thread_t *thread, void *obj)
{
switch_core_session_t *session = obj;
switch_channel_t *channel;
@ -321,6 +321,8 @@ static void *switch_core_service_thread(switch_thread_t *thread, void *obj)
return NULL;
}
switch_mutex_lock(session->frame_read_mutex);
channel = switch_core_session_get_channel(session);
switch_channel_set_flag(channel, CF_SERVICE);
@ -336,7 +338,10 @@ static void *switch_core_service_thread(switch_thread_t *thread, void *obj)
}
}
switch_mutex_unlock(session->frame_read_mutex);
switch_core_session_rwunlock(session);
return NULL;
}
@ -360,7 +365,7 @@ SWITCH_DECLARE(void) switch_core_service_session(switch_core_session_t *session)
channel = switch_core_session_get_channel(session);
switch_assert(channel);
switch_core_session_launch_thread(session, switch_core_service_thread, session);
switch_core_session_launch_thread(session, (void *(*)(switch_thread_t *,void *))switch_core_service_thread, session);
}
/* This function abstracts the thread creation for modules by allowing you to pass a function ptr and

View File

@ -1558,6 +1558,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_
switch_mutex_init(&session->resample_mutex, SWITCH_MUTEX_NESTED, session->pool);
switch_mutex_init(&session->codec_read_mutex, SWITCH_MUTEX_NESTED, session->pool);
switch_mutex_init(&session->codec_write_mutex, SWITCH_MUTEX_NESTED, session->pool);
switch_mutex_init(&session->frame_read_mutex, SWITCH_MUTEX_NESTED, session->pool);
switch_thread_rwlock_create(&session->bug_rwlock, session->pool);
switch_thread_cond_create(&session->cond, session->pool);
switch_thread_rwlock_create(&session->rwlock, session->pool);