diff --git a/configure.in b/configure.in index 1283b2a185..821c939399 100644 --- a/configure.in +++ b/configure.in @@ -577,7 +577,7 @@ AX_HAVE_CPU_SET AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])]) AC_CHECK_LIB(rt, clock_getres, [AC_DEFINE(HAVE_CLOCK_GETRES, 1, [Define if you have clock_getres()])]) AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])]) -AC_CHECK_LIB(pthread, pthread_setschedprio, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPRIO, 1, [Define if you have pthread_setschedprio()])]) +AC_CHECK_LIB(pthread, pthread_setschedparam, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM, 1, [Define if you have pthread_setschedparam()])]) AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket)) diff --git a/libs/apr/.update b/libs/apr/.update index a55ae9a4f4..c106d5b06f 100644 --- a/libs/apr/.update +++ b/libs/apr/.update @@ -1 +1 @@ -Tue Oct 23 13:13:30 EDT 2012 +Wed Nov 7 10:37:54 CST 2012 diff --git a/libs/apr/configure.in b/libs/apr/configure.in index 412ee7e937..354fa772ba 100644 --- a/libs/apr/configure.in +++ b/libs/apr/configure.in @@ -1620,7 +1620,7 @@ APR_CHECK_DEFINE_FILES(POLLIN, poll.h sys/poll.h) if test "$threads" = "1"; then APR_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h) AC_CHECK_FUNCS(pthread_mutexattr_setpshared) - AC_CHECK_LIB(pthread, pthread_setschedprio, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPRIO, 1, [Define if you have pthread_setschedprio()])]) + AC_CHECK_LIB(pthread, pthread_setschedparam, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM, 1, [Define if you have pthread_setschedparam()])]) # Some systems have setpshared and define PROCESS_SHARED, but don't # really support PROCESS_SHARED locks. So, we must validate that we diff --git a/libs/apr/threadproc/unix/thread.c b/libs/apr/threadproc/unix/thread.c index 391e5368c8..8859e79ac7 100644 --- a/libs/apr/threadproc/unix/thread.c +++ b/libs/apr/threadproc/unix/thread.c @@ -146,6 +146,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, { apr_status_t stat; pthread_attr_t *temp; + pthread_t tt; (*new) = (apr_thread_t *)apr_pcalloc(pool, sizeof(apr_thread_t)); @@ -173,15 +174,21 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, return stat; } - if ((stat = pthread_create((*new)->td, temp, dummy_worker, (*new))) == 0) { + if ((stat = pthread_create(&tt, temp, dummy_worker, (*new))) == 0) { -#ifdef HAVE_PTHREAD_SETSCHEDPRIO +#ifdef HAVE_PTHREAD_SETSCHEDPARAM if (attr && attr->priority) { - pthread_t *thread = (*new)->td; - pthread_setschedprio(*thread, attr->priority); + int policy; + struct sched_param param = { 0 }; + + pthread_getschedparam(tt, &policy, ¶m); + param.sched_priority = attr->priority; + pthread_setschedparam(tt, policy, ¶m); } #endif + *(*new)->td = tt; + return APR_SUCCESS; } else { diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 09f61c0ed4..5f41229805 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Fri Nov 2 13:36:06 CDT 2012 +Wed Nov 7 10:37:42 CST 2012 diff --git a/libs/sofia-sip/configure.ac b/libs/sofia-sip/configure.ac index 1bce33e178..f882bc76b4 100644 --- a/libs/sofia-sip/configure.ac +++ b/libs/sofia-sip/configure.ac @@ -254,7 +254,7 @@ if test x"$have_check" = "xyes"; then fi AC_CHECK_HEADERS([fnmatch.h]) -AC_CHECK_LIB(pthread, pthread_setschedprio, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPRIO, 1, [Define if you have pthread_setschedprio()])]) +AC_CHECK_LIB(pthread, pthread_setschedparam, [AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM, 1, [Define if you have pthread_setschedparam()])]) dnl dl is currently used only in testing diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c b/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c index 5eb391f38d..d20eb709bd 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c @@ -268,9 +268,13 @@ int su_pthreaded_port_start(su_port_create_f *create, pthread_mutex_lock(arg.mutex); if (pthread_create(&tid, &attr, su_pthread_port_clone_main, &arg) == 0) { +#ifdef HAVE_PTHREAD_SETSCHEDPARAM + int policy; + struct sched_param param; -#ifdef HAVE_PTHREAD_SETSCHEDPRIO - pthread_setschedprio(tid, 99); + pthread_getschedparam(tid, &policy, ¶m); + param.sched_priority = 99; + pthread_setschedparam(tid, policy, ¶m); #endif pthread_cond_wait(arg.cv, arg.mutex); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 7e55407962..cf89cba93c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -6532,6 +6532,9 @@ char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex switch_cache_db_release_db_handle(&dbh); + + sofia_glue_fire_events(profile); + return ret; } @@ -7159,6 +7162,23 @@ void sofia_event_fire(sofia_profile_t *profile, switch_event_t **event) *event = NULL; } +void sofia_glue_fire_events(sofia_profile_t *profile) +{ + void *pop = NULL; + + while (profile->event_queue && switch_queue_trypop(profile->event_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { + switch_event_t *event = (switch_event_t *) pop; + switch_event_fire(&event); + } + +} + +void sofia_event_fire(sofia_profile_t *profile, switch_event_t **event) +{ + switch_queue_push(profile->event_queue, *event); + *event = NULL; +} + /* For Emacs: * Local Variables: