Rev 2096 | Rev 2105 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2096 | Rev 2103 | ||
|---|---|---|---|
| Line 131... | Line 131... | ||
| 131 | btree_t futexes; /**< B+tree of futexes referenced by this task. */ |
131 | btree_t futexes; /**< B+tree of futexes referenced by this task. */ |
| 132 | 132 | ||
| 133 | uint64_t cycles; /**< Accumulated accounting. */ |
133 | uint64_t cycles; /**< Accumulated accounting. */ |
| 134 | } task_t; |
134 | } task_t; |
| 135 | 135 | ||
| 136 | typedef void (* timeout_handler_t)(void *arg); |
- | |
| 137 | - | ||
| 138 | typedef struct { |
- | |
| 139 | SPINLOCK_DECLARE(lock); |
- | |
| 140 | - | ||
| 141 | link_t link; /**< Link to the list of active timeouts on THE->cpu */ |
- | |
| 142 | - | ||
| 143 | uint64_t ticks; /**< Timeout will be activated in this amount of clock() ticks. */ |
- | |
| 144 | - | ||
| 145 | timeout_handler_t handler; /**< Function that will be called on timeout activation. */ |
- | |
| 146 | void *arg; /**< Argument to be passed to handler() function. */ |
- | |
| 147 | - | ||
| 148 | cpu_t *cpu; /**< On which processor is this timeout registered. */ |
- | |
| 149 | } timeout_t; |
- | |
| 150 | - | ||
| 151 | /** Thread states. */ |
- | |
| 152 | typedef enum { |
- | |
| 153 | Invalid, /**< It is an error, if thread is found in this state. */ |
- | |
| 154 | Running, /**< State of a thread that is currently executing on some CPU. */ |
- | |
| 155 | Sleeping, /**< Thread in this state is waiting for an event. */ |
- | |
| 156 | Ready, /**< State of threads in a run queue. */ |
- | |
| 157 | Entering, /**< Threads are in this state before they are first readied. */ |
- | |
| 158 | Exiting, /**< After a thread calls thread_exit(), it is put into Exiting state. */ |
- | |
| 159 | Undead /**< Threads that were not detached but exited are in the Undead state. */ |
- | |
| 160 | } state_t; |
- | |
| 161 | - | ||
| 162 | /** Join types. */ |
- | |
| 163 | typedef enum { |
- | |
| 164 | None, |
- | |
| 165 | TaskClnp, /**< The thread will be joined by ktaskclnp thread. */ |
- | |
| 166 | TaskGC /**< The thread will be joined by ktaskgc thread. */ |
- | |
| 167 | } thread_join_type_t; |
- | |
| 168 | - | ||
| 169 | SPINLOCK_EXTERN(tasks_lock); |
136 | SPINLOCK_EXTERN(tasks_lock); |
| 170 | extern btree_t tasks_btree; |
137 | extern btree_t tasks_btree; |
| 171 | 138 | ||
| 172 | extern void task_init(void); |
139 | extern void task_init(void); |
| 173 | extern task_t *task_create(as_t *as, char *name); |
140 | extern task_t *task_create(as_t *as, char *name); |