xref: /nrf52832-nimble/rt-thread/components/libc/pthreads/sched.c (revision 104654410c56c573564690304ae786df310c91fc)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  */
9 
10 #include <sched.h>
11 
sched_yield(void)12 int sched_yield(void)
13 {
14     rt_thread_yield();
15 
16     return 0;
17 }
18 RTM_EXPORT(sched_yield);
19 
sched_get_priority_min(int policy)20 int sched_get_priority_min(int policy)
21 {
22     if (policy != SCHED_FIFO && policy != SCHED_RR)
23         return EINVAL;
24 
25     return 0;
26 }
27 RTM_EXPORT(sched_get_priority_min);
28 
sched_get_priority_max(int policy)29 int sched_get_priority_max(int policy)
30 {
31     if (policy != SCHED_FIFO && policy != SCHED_RR)
32         return EINVAL;
33 
34     return RT_THREAD_PRIORITY_MAX - 1;
35 }
36 RTM_EXPORT(sched_get_priority_max);
37 
sched_setscheduler(pid_t pid,int policy)38 int sched_setscheduler(pid_t pid, int policy)
39 {
40     return EOPNOTSUPP;
41 }
42 RTM_EXPORT(sched_setscheduler);
43