]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix thread priority code, this has never worked until today
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 27 Sep 2012 18:37:54 +0000 (13:37 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 27 Sep 2012 18:38:02 +0000 (13:38 -0500)
libs/apr/.update
libs/apr/include/arch/unix/apr_arch_threadproc.h
libs/apr/threadproc/unix/thread.c
src/switch_apr.c

index d5bc43d9d4050b8272100935576d145a690ed5df..4452df8ef3af8c468ce42d9ea3e860db9edf2b16 100644 (file)
@@ -1 +1 @@
-Mon Sep 27 13:15:54 CDT 2010
+Thu Sep 27 13:36:14 CDT 2012
index 6b0180234d04eb06883b012e49b3fa3241e48f4e..bd9359a49f80b00bb43af452325e5995e81596f9 100644 (file)
@@ -60,6 +60,7 @@ struct apr_thread_t {
 struct apr_threadattr_t {
     apr_pool_t *pool;
     pthread_attr_t attr;
+       int priority;
 };
 
 struct apr_threadkey_t {
index 28fcef0aef32b5c18fccaa5986e04419309cc6de..9a56e554052e6a972a4549c209b2a43571dca153 100644 (file)
@@ -174,6 +174,11 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
     }
 
     if ((stat = pthread_create((*new)->td, temp, dummy_worker, (*new))) == 0) {
+               if (attr->priority) {
+                       pthread_t *thread = (*new)->td;
+                       pthread_setschedprio(*thread, attr->priority);
+               }
+
         return APR_SUCCESS;
     }
     else {
index c854c9761720e3c8a022b12520f1c5933f7822e4..dfb56d53908615a506f92e61a9d0dfff7899a2b7 100644 (file)
@@ -633,25 +633,16 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadatt
 struct apr_threadattr_t {
        apr_pool_t *pool;
        pthread_attr_t attr;
+       int priority;
 };
 #endif
 
 SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_increase(switch_threadattr_t *attr)
 {
-       int stat = 0;
 #ifndef WIN32
-       struct sched_param param;
-       struct apr_threadattr_t *myattr = attr;
-
-       pthread_attr_getschedparam(&myattr->attr, &param);
-       param.sched_priority = 1;
-       stat = pthread_attr_setschedparam(&myattr->attr, &param);
-
-       if (stat == 0) {
-               return SWITCH_STATUS_SUCCESS;
-       }
+       attr->priority = 10;
 #endif
-       return stat;
+       return SWITCH_STATUS_SUCCESS;
 }
 
 static char TT_KEY[] = "1";