Changeset 639 for pjproject/trunk
- Timestamp:
- Jul 31, 2006 6:54:06 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/siprtp.c
r626 r639 1057 1057 } 1058 1058 1059 #elif defined(PJ_LINUX) && PJ_LINUX != 0 1060 #include <pthread.h> 1061 static void boost_priority(void) 1062 { 1063 #define POLICY SCHED_FIFO 1064 pthread_t thread; 1065 struct sched_param tp; 1066 int max_prio; 1067 int policy; 1068 int rc; 1069 1070 if (sched_get_priority_min(POLICY) < sched_get_priority_max(POLICY)) 1071 max_prio = sched_get_priority_max(POLICY)-1; 1072 else 1073 max_prio = sched_get_priority_max(POLICY)+1; 1074 1075 /* 1076 * Adjust process scheduling algorithm and priority 1077 */ 1078 rc = sched_getparam(0, &tp); 1079 if (rc != 0) { 1080 app_perror( THIS_FILE, "sched_getparam error", 1081 PJ_RETURN_OS_ERROR(rc)); 1082 return; 1083 } 1084 tp.__sched_priority = max_prio; 1085 1086 rc = sched_setscheduler(0, POLICY, &tp); 1087 if (rc != 0) { 1088 app_perror( THIS_FILE, "sched_setscheduler error", 1089 PJ_RETURN_OS_ERROR(rc)); 1090 } 1091 1092 PJ_LOG(4, (THIS_FILE, "New process policy=%d, priority=%d", 1093 policy, tp.__sched_priority)); 1094 1095 /* 1096 * Adjust thread scheduling algorithm and priority 1097 */ 1098 rc = pthread_getschedparam(pthread_self(), &policy, &tp); 1099 if (rc != 0) { 1100 app_perror( THIS_FILE, "pthread_getschedparam error", 1101 PJ_RETURN_OS_ERROR(rc)); 1102 return; 1103 } 1104 1105 PJ_LOG(4, (THIS_FILE, "Old thread policy=%d, priority=%d", 1106 policy, tp.__sched_priority)); 1107 1108 policy = POLICY; 1109 tp.__sched_priority = max_prio; 1110 1111 rc = pthread_setschedparam(pthread_self(), policy, &tp); 1112 if (rc != 0) { 1113 app_perror( THIS_FILE, "pthread_setschedparam error", 1114 PJ_RETURN_OS_ERROR(rc)); 1115 return; 1116 } 1117 1118 PJ_LOG(4, (THIS_FILE, "New thread policy=%d, priority=%d", 1119 policy, tp.__sched_priority)); 1120 } 1121 1059 1122 #else 1060 1123 # define boost_priority()
Note: See TracChangeset
for help on using the changeset viewer.