Fix mapping between sched_attr and SchedPolicy

This commit is contained in:
js2xxx
2025-06-18 11:48:11 +00:00
committed by Jianfeng Jiang
parent 0875cf6644
commit c5d57d5216
3 changed files with 50 additions and 5 deletions

View File

@ -0,0 +1,31 @@
// SPDX-License-Identifier: MPL-2.0
#define _GNU_SOURCE
#include <assert.h>
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define SCHED_IDLE 5
void *test(void *__arg)
{
struct sched_param param = { .sched_priority = 0 };
assert(sched_setscheduler(0, SCHED_IDLE, &param) == 0);
sleep(1);
return NULL;
}
int main()
{
pthread_t thread;
assert(pthread_create(&thread, NULL, test, NULL) == 0);
test(NULL);
pthread_join(thread, NULL);
printf("Test completed\n");
return 0;
}

View File

@ -39,6 +39,7 @@ pthread/pthread_test
pty/open_pty
pty/pty_blocking
sched/sched_attr
sched/sched_attr_idle
shm/posix_shm
signal_c/parent_death_signal
signal_c/signal_test