]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/cloudlibc/src/libc/sched/sched_yield.c
e48e3c7463857d1880d22d4d41757edff7e4001e
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / libc / sched / sched_yield.c
1 // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
2 //
3 // SPDX-License-Identifier: BSD-2-Clause
4
5 #include <wasi/api.h>
6 #include <errno.h>
7 #include <sched.h>
8
9 int sched_yield(void) {
10 #ifdef __wasilibc_unmodified_upstream
11 __wasi_errno_t error = __wasi_thread_yield();
12 #else
13 __wasi_errno_t error = __wasi_sched_yield();
14 #endif
15 if (error != 0) {
16 errno = error;
17 return -1;
18 }
19 return 0;
20 }