Rémi Bernon (@rbernon) commented about server/thread.c:
return mask;
}
+static int get_base_priority( int priority_class, int priority ) +{
- static const int class_offsets[] = { 4, 8, 13, 24, 6, 10 };
- assert(priority_class <= ARRAY_SIZE(class_offsets));
- if (priority == THREAD_PRIORITY_IDLE) return (priority_class == PROCESS_PRIOCLASS_REALTIME ? 16 : 1);
- else if (priority == THREAD_PRIORITY_TIME_CRITICAL) return (priority_class == PROCESS_PRIOCLASS_REALTIME ? 31 : 15);
- else return class_offsets[priority_class - 1] + priority;
I think asserts are not well appreciated on the server side, maybe just a check if it's out of bounds. Also elses are unnecessary:
```suggestion:-4+0 static const int class_offsets[] = { 4, 8, 13, 24, 6, 10 }; if (priority == THREAD_PRIORITY_IDLE) return (priority_class == PROCESS_PRIOCLASS_REALTIME ? 16 : 1); if (priority == THREAD_PRIORITY_TIME_CRITICAL) return (priority_class == PROCESS_PRIOCLASS_REALTIME ? 31 : 15); if (priority_class >= ARRAY_SIZE(class_offsets))) return 16; return class_offsets[priority_class - 1] + priority; ```