KallistiOS  2.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
sched.h
Go to the documentation of this file.
1 /** \file sys/sched.h
2  \brief Basic sys/sched.h file for newlib.
3 
4  This file specifies a few things to make sure pthreads stuff compiles.
5 */
6 
7 #ifndef __SYS_SCHED_H
8 #define __SYS_SCHED_H
9 
10 #include <kos/cdefs.h>
11 __BEGIN_DECLS
12 
13 // These are copied from Newlib to make stuff compile as expected.
14 
15 #define SCHED_OTHER 0 /**< \brief Other scheduling */
16 #define SCHED_FIFO 1 /**< \brief FIFO scheduling */
17 #define SCHED_RR 2 /**< \brief Round-robin scheduling */
18 
19 /** \brief Scheduling Parameters, P1003.1b-1993, p. 249.
20  \note Fields whose name begins with "ss_" added by P1003.4b/D8, p. 33.
21  \headerfile sys/sched.h
22 */
23 struct sched_param {
24  int sched_priority; /**< \brief Process execution scheduling priority */
25 };
26 
27 // And all this maps pthread types to KOS types for pthread.h.
28 #include <kos/thread.h>
29 #include <kos/sem.h>
30 #include <kos/cond.h>
31 #include <kos/mutex.h>
32 #include <kos/tls.h>
33 #include <kos/once.h>
34 
35 // Missing structs we don't care about in this impl.
36 /** \brief POSIX mutex attributes.
37 
38  Not implemented in KOS.
39 
40  \headerfile sys/sched.h
41 */
42 typedef struct {
43  // Empty
45 
46 /** \brief POSIX condition variable attributes.
47 
48  Not implemented in KOS.
49 
50  \headerfile sys/sched.h
51 */
52 typedef struct {
53  // Empty
55 
56 /** \brief POSIX thread attributes.
57 
58  Not implemented in KOS.
59 
60  \headerfile sys/sched.h
61 */
62 typedef struct {
63  // Empty
65 
66 // Map over KOS types. The mutex/condvar maps have to be pointers
67 // because we allow _INIT #defines to work.
68 typedef kthread_t * pthread_t; /**< \brief POSIX thread type */
69 typedef mutex_t pthread_mutex_t; /**< \brief POSIX mutex type */
70 typedef condvar_t pthread_cond_t; /**< \brief POSIX condition type */
71 
72 // These, on the other hand, map right over.
73 typedef kthread_once_t pthread_once_t; /**< \brief POSIX once control */
74 typedef kthread_key_t pthread_key_t; /**< \brief POSIX thread data key */
75 
76 __END_DECLS
77 
78 #endif /* __SYS_SCHED_H */