KallistiOS  ##version##
 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 */
Thread-local storage support.
kthread_key_t pthread_key_t
POSIX thread data key.
Definition: sched.h:74
int sched_priority
Process execution scheduling priority.
Definition: sched.h:24
Object type backing kthread_once.
Definition: once.h:34
Scheduling Parameters, P1003.1b-1993, p. 249.
Definition: sched.h:23
Semaphores.
POSIX mutex attributes.
Definition: sched.h:42
Threading support.
Dynamic package initialization.
Condition variable.
Definition: cond.h:61
Mutual exclusion lock type.
Definition: mutex.h:70
kthread_once_t pthread_once_t
POSIX once control.
Definition: sched.h:73
Structure describing one running thread.
Definition: thread.h:90
Mutual exclusion locks.
POSIX thread attributes.
Definition: sched.h:62
Potentially useful definitions for C Programs.
POSIX condition variable attributes.
Definition: sched.h:52
mutex_t pthread_mutex_t
POSIX mutex type.
Definition: sched.h:69
Condition variables.
condvar_t pthread_cond_t
POSIX condition type.
Definition: sched.h:70
kthread_t * pthread_t
POSIX thread type.
Definition: sched.h:68
int kthread_key_t
Thread-local storage key type.
Definition: tls.h:27