FS-7969 #resolve [Freeswitch segfaults due to pthread_setschedparam() on a thread that has exited] #comment please test this fix which was verified working
This commit is contained in:
parent
fa8f304248
commit
f43510f243
|
@ -1 +1 @@
|
||||||
Tue Aug 27 13:58:18 EDT 2013
|
Wed Aug 19 11:38:49 CDT 2015
|
||||||
|
|
|
@ -55,6 +55,7 @@ struct apr_thread_t {
|
||||||
void *data;
|
void *data;
|
||||||
apr_thread_start_t func;
|
apr_thread_start_t func;
|
||||||
apr_status_t exitval;
|
apr_status_t exitval;
|
||||||
|
int priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct apr_threadattr_t {
|
struct apr_threadattr_t {
|
||||||
|
|
|
@ -135,6 +135,19 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
|
||||||
static void *dummy_worker(void *opaque)
|
static void *dummy_worker(void *opaque)
|
||||||
{
|
{
|
||||||
apr_thread_t *thread = (apr_thread_t*)opaque;
|
apr_thread_t *thread = (apr_thread_t*)opaque;
|
||||||
|
|
||||||
|
#ifdef HAVE_PTHREAD_SETSCHEDPARAM
|
||||||
|
if (thread->priority) {
|
||||||
|
int policy;
|
||||||
|
struct sched_param param = { 0 };
|
||||||
|
pthread_t tt = pthread_self();
|
||||||
|
|
||||||
|
pthread_getschedparam(tt, &policy, ¶m);
|
||||||
|
param.sched_priority = thread->priority;
|
||||||
|
pthread_setschedparam(tt, policy, ¶m);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return thread->func(thread, thread->data);
|
return thread->func(thread, thread->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,19 +187,11 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
|
||||||
return stat;
|
return stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (attr && attr->priority) {
|
||||||
|
(*new)->priority = attr->priority;
|
||||||
|
}
|
||||||
|
|
||||||
if ((stat = pthread_create(&tt, temp, dummy_worker, (*new))) == 0) {
|
if ((stat = pthread_create(&tt, temp, dummy_worker, (*new))) == 0) {
|
||||||
|
|
||||||
#ifdef HAVE_PTHREAD_SETSCHEDPARAM
|
|
||||||
if (attr && 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;
|
*(*new)->td = tt;
|
||||||
|
|
||||||
return APR_SUCCESS;
|
return APR_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue