libc: Add sched_yield()

This commit is contained in:
apio 2022-10-15 11:43:13 +02:00
parent b0e071e964
commit 523e88e5a9
2 changed files with 27 additions and 0 deletions

16
libs/libc/include/sched.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef _SCHED_H
#define _SCHED_H
#ifdef __cplusplus
extern "C"
{
#endif
/* Yield the processor. */
int sched_yield(void);
#ifdef __cplusplus
}
#endif
#endif

11
libs/libc/src/sched.cpp Normal file
View File

@ -0,0 +1,11 @@
#include <sched.h>
#include <sys/syscall.h>
#include <unistd.h>
extern "C"
{
int sched_yield()
{
return (int)syscall(SYS_yield);
}
}