xref: /haiku/src/system/libroot/posix/scheduler.cpp (revision f386c5910b0920cfa24950dfe81eee67e7d7ba67)
1 /*
2  * Copyright 2009, Michael Franz
3  * Copyright 2008, Andreas Färber, andreas.faerber@web.de
4  * Distributed under the terms of the MIT license.
5  */
6 
7 #include <errno.h>
8 #include <sched.h>
9 
10 #include <OS.h>
11 
12 #include <syscalls.h>
13 
14 
15 int
16 sched_yield(void)
17 {
18 	_kern_thread_yield();
19 	return 0;
20 }
21 
22 
23 int
24 sched_get_priority_min(int policy)
25 {
26 	switch (policy) {
27 		case SCHED_FIFO:
28 		case SCHED_RR:
29 		case SCHED_OTHER:
30 			return B_LOW_PRIORITY;
31 		default:
32 			errno = EINVAL;
33 			return -1;
34 	}
35 }
36 
37 
38 int
39 sched_get_priority_max(int policy)
40 {
41 	switch (policy) {
42 		case SCHED_FIFO:
43 		case SCHED_RR:
44 		case SCHED_OTHER:
45 			return B_REAL_TIME_PRIORITY;
46 		default:
47 			errno = EINVAL;
48 			return -1;
49 	}
50 }
51