@@ -212,13 +212,13 @@ int Common::SetThreadName(std::thread* t, const std::string& name) {
212212#endif
213213}
214214
215- int Common::SetProcessPriority (ProcessPriority pp ) {
215+ int Common::SetProcessSchedPriority (SchedPriority sp ) {
216216#if defined(MYFRAME_OS_WINDOWS)
217217 HANDLE hProcess = ::GetCurrentProcess ();
218218 int process_pri;
219- if (pp == ProcessPriority ::kLowest ) {
219+ if (sp == SchedPriority ::kLowest ) {
220220 process_pri = IDLE_PRIORITY_CLASS;
221- } else if (pp == ProcessPriority ::kNormal ) {
221+ } else if (sp == SchedPriority ::kNormal ) {
222222 process_pri = NORMAL_PRIORITY_CLASS;
223223 } else {
224224 process_pri = REALTIME_PRIORITY_CLASS;
@@ -228,8 +228,8 @@ int Common::SetProcessPriority(ProcessPriority pp) {
228228 }
229229 return 0 ;
230230#elif defined(MYFRAME_OS_MACOSX)
231- (void )pp ;
232- return - 1 ;
231+ (void )sp ;
232+ return 0 ;
233233#else
234234 struct sched_param process_param;
235235 int sched_policy = sched_getscheduler (0 );
@@ -239,10 +239,10 @@ int Common::SetProcessPriority(ProcessPriority pp) {
239239 if (sched_getparam (0 , &process_param) == -1 ) {
240240 return -1 ;
241241 }
242- if (pp == ProcessPriority ::kLowest ) {
242+ if (sp == SchedPriority ::kLowest ) {
243243 process_param.sched_priority = 0 ;
244244 sched_policy = SCHED_IDLE;
245- } else if (pp == ProcessPriority ::kNormal ) {
245+ } else if (sp == SchedPriority ::kNormal ) {
246246 process_param.sched_priority = 0 ;
247247 sched_policy = SCHED_OTHER;
248248 } else {
@@ -256,19 +256,19 @@ int Common::SetProcessPriority(ProcessPriority pp) {
256256#endif
257257}
258258
259- int Common::SetThreadPriority (std::thread* t, ThreadPriority tp ) {
259+ int Common::SetThreadSchedPriority (std::thread* t, SchedPriority sp ) {
260260#if defined(MYFRAME_OS_WINDOWS)
261261 int thread_pri;
262- if (tp == ThreadPriority ::kLowest ) {
262+ if (sp == SchedPriority ::kLowest ) {
263263 thread_pri = THREAD_PRIORITY_IDLE;
264- } else if (tp == ThreadPriority ::kNormal ) {
264+ } else if (sp == SchedPriority ::kNormal ) {
265265 thread_pri = THREAD_PRIORITY_NORMAL;
266266 } else {
267267 thread_pri = THREAD_PRIORITY_TIME_CRITICAL;
268268 }
269269 HANDLE thread_handle;
270270 if (t == nullptr ) {
271- thread_handle = GetCurrentThread ();
271+ thread_handle = :: GetCurrentThread ();
272272 } else {
273273 thread_handle = t->native_handle ();
274274 }
@@ -288,10 +288,10 @@ int Common::SetThreadPriority(std::thread* t, ThreadPriority tp) {
288288 if (pthread_getschedparam (handle, &sched_policy, &thread_param)) {
289289 return -1 ;
290290 }
291- if (tp == ThreadPriority ::kLowest ) {
291+ if (sp == SchedPriority ::kLowest ) {
292292 thread_param.sched_priority = 0 ;
293293 sched_policy = SCHED_OTHER;
294- } else if (tp == ThreadPriority ::kNormal ) {
294+ } else if (sp == SchedPriority ::kNormal ) {
295295 thread_param.sched_priority = 31 ;
296296 sched_policy = SCHED_OTHER;
297297 } else {
@@ -314,10 +314,10 @@ int Common::SetThreadPriority(std::thread* t, ThreadPriority tp) {
314314 if (pthread_getschedparam (handle, &sched_policy, &thread_param)) {
315315 return -1 ;
316316 }
317- if (tp == ThreadPriority ::kLowest ) {
317+ if (sp == SchedPriority ::kLowest ) {
318318 thread_param.sched_priority = 0 ;
319319 sched_policy = SCHED_IDLE;
320- } else if (tp == ThreadPriority ::kNormal ) {
320+ } else if (sp == SchedPriority ::kNormal ) {
321321 thread_param.sched_priority = 0 ;
322322 sched_policy = SCHED_OTHER;
323323 } else {
0 commit comments