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