xref: /haiku/src/system/libroot/posix/scheduler.cpp (revision d88b4037b040ed795b06e505383e661f1bb0a3a0)
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 
8 #include <errno.h>
9 #include <sched.h>
10 
11 #include <OS.h>
12 
13 #include <syscalls.h>
14 
15 
16 int
17 sched_yield(void)
18 {
19 	_kern_thread_yield();
20 	return 0;
21 }
22 
23 
24 int
25 sched_get_priority_min(int policy)
26 {
27 	switch (policy) {
28 		case SCHED_FIFO:
29 		case SCHED_RR:
30 		case SCHED_OTHER:
31 			return B_LOW_PRIORITY;
32 
33 		default:
34 			errno = EINVAL;
35 			return -1;
36 	}
37 }
38 
39 
40 int
41 sched_get_priority_max(int policy)
42 {
43 	switch (policy) {
44 		case SCHED_FIFO:
45 		case SCHED_RR:
46 		case SCHED_OTHER:
47 			return B_URGENT_DISPLAY_PRIORITY;
48 
49 		default:
50 			errno = EINVAL;
51 			return -1;
52 	}
53 }
54