mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-29 14:53:24 +00:00
31 lines
537 B
C
31 lines
537 B
C
// 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, ¶m) == 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;
|
|
} |