KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
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*/
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*/
42typedef struct {
43 // Empty
45
46/** \brief POSIX condition variable attributes.
47
48 Not implemented in KOS.
49
50 \headerfile sys/sched.h
51*/
52typedef struct {
53 // Empty
55
56/** \brief POSIX thread attributes.
57
58 Not implemented in KOS.
59
60 \headerfile sys/sched.h
61*/
62typedef 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.
68typedef kthread_t * pthread_t; /**< \brief POSIX thread type */
69typedef mutex_t pthread_mutex_t; /**< \brief POSIX mutex type */
70typedef condvar_t pthread_cond_t; /**< \brief POSIX condition type */
71
72// These, on the other hand, map right over.
73typedef kthread_once_t pthread_once_t; /**< \brief POSIX once control */
74typedef kthread_key_t pthread_key_t; /**< \brief POSIX thread data key */
75
76__END_DECLS
77
78#endif /* __SYS_SCHED_H */
Definitions for builtin attributes and compiler directives.
Condition variables.
Mutual exclusion locks.
Dynamic package initialization.
volatile int kthread_once_t
Object type backing kthread_once.
Definition once.h:35
condvar_t pthread_cond_t
POSIX condition type.
Definition sched.h:70
kthread_key_t pthread_key_t
POSIX thread data key.
Definition sched.h:74
kthread_t * pthread_t
POSIX thread type.
Definition sched.h:68
mutex_t pthread_mutex_t
POSIX mutex type.
Definition sched.h:69
kthread_once_t pthread_once_t
POSIX once control.
Definition sched.h:73
Semaphores.
Condition variable.
Definition cond.h:62
Structure describing one running thread.
Definition thread.h:169
Mutual exclusion lock type.
Definition mutex.h:68
POSIX thread attributes.
Definition sched.h:62
POSIX condition variable attributes.
Definition sched.h:52
POSIX mutex attributes.
Definition sched.h:42
Scheduling Parameters, P1003.1b-1993, p.
Definition sched.h:23
int sched_priority
Process execution scheduling priority.
Definition sched.h:24
Threading support.
Thread-local storage support.
int kthread_key_t
Thread-local storage key type.
Definition tls.h:28