xref: /haiku/src/system/libroot/posix/scheduler.cpp (revision b55a57da7173b9af0432bd3e148d03f06161d036)
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_SPORADIC:
31 		case SCHED_OTHER:
32 			return B_LOW_PRIORITY;
33 
34 		default:
35 			errno = EINVAL;
36 			return -1;
37 	}
38 }
39 
40 
41 int
42 sched_get_priority_max(int policy)
43 {
44 	switch (policy) {
45 		case SCHED_FIFO:
46 		case SCHED_RR:
47 		case SCHED_SPORADIC:
48 		case SCHED_OTHER:
49 			return B_URGENT_DISPLAY_PRIORITY;
50 
51 		default:
52 			errno = EINVAL;
53 			return -1;
54 	}
55 }
56