Home » U++ Library support » U++ Core » Division by 0 in Thread::Priority
Division by 0 in Thread::Priority [message #45011] |
Mon, 17 August 2015 08:16 |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
If Priority function is executed with priority level above 125 (for example 150) there is division by 0.
bool Thread::Priority(int percent)
{
[...]
if (pthread_setschedparam(handle, policy, ¶m)) {// if this function fails (user has no right to set such high priority)
policy = SCHED_OTHER;
//max is changed from 175 to 125
percent_max = 125;
//min is still 125
percent_min = minmax(percent_min, 0, percent_max);
//and (percent_max - percent_min) is 0
param.sched_priority = (sched_get_priority_max(policy) - sched_get_priority_min(policy))*(minmax(percent, percent_min, percent_max)-percent_min)/(percent_max - percent_min);
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 15:09:46 CEST 2024
Total time taken to generate the page: 0.02873 seconds
|