mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
Kernel+LibC: Report correct scheduling priority limits
The priority range was changed several years ago, but the userland-reported limits were just forgotten :skeleyak:. Move the thread priority constants into an API header so that userland can use it properly.
This commit is contained in:
parent
ce25bd8584
commit
6dded99777
Notes:
sideshowbarker
2024-07-17 05:04:16 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/6dded99777 Pull-request: https://github.com/SerenityOS/serenity/pull/14672 Reviewed-by: https://github.com/linusg Reviewed-by: https://github.com/timschumi
3 changed files with 9 additions and 8 deletions
|
@ -16,6 +16,12 @@ struct sched_param {
|
|||
int sched_priority;
|
||||
};
|
||||
|
||||
#define THREAD_PRIORITY_MIN 1
|
||||
#define THREAD_PRIORITY_LOW 10
|
||||
#define THREAD_PRIORITY_NORMAL 30
|
||||
#define THREAD_PRIORITY_HIGH 50
|
||||
#define THREAD_PRIORITY_MAX 99
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <AK/Time.h>
|
||||
#include <AK/Variant.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <Kernel/API/POSIX/sched.h>
|
||||
#include <Kernel/Arch/RegisterState.h>
|
||||
#include <Kernel/Debug.h>
|
||||
#include <Kernel/Forward.h>
|
||||
|
@ -46,12 +47,6 @@ struct ThreadSpecificData {
|
|||
ThreadSpecificData* self;
|
||||
};
|
||||
|
||||
#define THREAD_PRIORITY_MIN 1
|
||||
#define THREAD_PRIORITY_LOW 10
|
||||
#define THREAD_PRIORITY_NORMAL 30
|
||||
#define THREAD_PRIORITY_HIGH 50
|
||||
#define THREAD_PRIORITY_MAX 99
|
||||
|
||||
#define THREAD_AFFINITY_DEFAULT 0xffffffff
|
||||
|
||||
struct ThreadRegisters {
|
||||
|
|
|
@ -20,13 +20,13 @@ int sched_yield()
|
|||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_get_priority_min.html
|
||||
int sched_get_priority_min([[maybe_unused]] int policy)
|
||||
{
|
||||
return 0; // Idle
|
||||
return THREAD_PRIORITY_MIN;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_get_priority_max.html
|
||||
int sched_get_priority_max([[maybe_unused]] int policy)
|
||||
{
|
||||
return 3; // High
|
||||
return THREAD_PRIORITY_MAX;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_setparam.html
|
||||
|
|
Loading…
Reference in a new issue