Changes in kernel/generic/include/proc/thread.h [da1bafb:e1b6742] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/proc/thread.h
rda1bafb re1b6742 50 50 #include <sysinfo/abi.h> 51 51 52 #define THREAD_STACK_SIZE 53 #define THREAD_NAME_BUFLEN 52 #define THREAD_STACK_SIZE STACK_SIZE 53 #define THREAD_NAME_BUFLEN 20 54 54 55 55 extern const char *thread_states[]; … … 61 61 * When using this flag, the caller must set cpu in the thread_t 62 62 * structure manually before calling thread_ready (even on uniprocessor). 63 * 64 */ 65 #define THREAD_FLAG_WIRED (1 << 0) 66 63 */ 64 #define THREAD_FLAG_WIRED (1 << 0) 67 65 /** Thread was migrated to another CPU and has not run yet. */ 68 #define THREAD_FLAG_STOLEN (1 << 1) 69 66 #define THREAD_FLAG_STOLEN (1 << 1) 70 67 /** Thread executes in userspace. */ 71 #define THREAD_FLAG_USPACE (1 << 2) 72 68 #define THREAD_FLAG_USPACE (1 << 2) 73 69 /** Thread will be attached by the caller. */ 74 #define THREAD_FLAG_NOATTACH 70 #define THREAD_FLAG_NOATTACH (1 << 3) 75 71 76 72 /** Thread structure. There is one per thread. */ 77 73 typedef struct thread { 78 link_t rq_link; 79 link_t wq_link; 80 link_t th_link; 81 74 link_t rq_link; /**< Run queue link. */ 75 link_t wq_link; /**< Wait queue link. */ 76 link_t th_link; /**< Links to threads within containing task. */ 77 82 78 /** Threads linkage to the threads_tree. */ 83 79 avltree_node_t threads_tree_node; … … 87 83 * Protects the whole thread structure except list links above. 88 84 */ 89 IRQ_SPINLOCK_DECLARE(lock);90 85 SPINLOCK_DECLARE(lock); 86 91 87 char name[THREAD_NAME_BUFLEN]; 92 88 93 89 /** Function implementing the thread. */ 94 90 void (* thread_code)(void *); 95 91 /** Argument passed to thread_code() function. */ 96 92 void *thread_arg; 97 93 98 94 /** 99 95 * From here, the stored context is restored when the thread is … … 111 107 */ 112 108 context_t sleep_interruption_context; 113 109 114 110 /** If true, the thread can be interrupted from sleep. */ 115 111 bool sleep_interruptible; … … 119 115 timeout_t sleep_timeout; 120 116 /** Flag signalling sleep timeout in progress. */ 121 volatile booltimeout_pending;122 117 volatile int timeout_pending; 118 123 119 /** 124 120 * True if this thread is executing copy_from_uspace(). … … 136 132 * thread_exit() before returning to userspace. 137 133 */ 138 bool interrupted; 134 bool interrupted; 139 135 140 136 /** If true, thread_join_timeout() cannot be used on this thread. */ … … 144 140 /** Link used in the joiner_head list. */ 145 141 link_t joiner_link; 146 142 147 143 fpu_context_t *saved_fpu_context; 148 144 int fpu_context_exists; 149 145 150 146 /* 151 147 * Defined only if thread doesn't run. … … 154 150 */ 155 151 int fpu_context_engaged; 156 152 157 153 rwlock_type_t rwlock_holder_type; 158 154 159 155 /** Callback fired in scheduler before the thread is put asleep. */ 160 156 void (* call_me)(void *); 161 157 /** Argument passed to call_me(). */ 162 158 void *call_me_with; 163 159 164 160 /** Thread's state. */ 165 161 state_t state; 166 162 /** Thread's flags. */ 167 unsignedint flags;163 int flags; 168 164 169 165 /** Thread's CPU. */ … … 171 167 /** Containing task. */ 172 168 task_t *task; 173 169 174 170 /** Ticks before preemption. */ 175 171 uint64_t ticks; … … 180 176 /** Last sampled cycle. */ 181 177 uint64_t last_cycle; 182 /** Thread doesn't affect accumulated accounting. */ 178 /** Thread doesn't affect accumulated accounting. */ 183 179 bool uncounted; 184 180 185 181 /** Thread's priority. Implemented as index to CPU->rq */ 186 182 int priority; … … 190 186 /** Architecture-specific data. */ 191 187 thread_arch_t arch; 192 188 193 189 /** Thread's kernel stack. */ 194 190 uint8_t *kstack; 195 191 196 192 #ifdef CONFIG_UDEBUG 197 193 /** Debugging stuff */ 198 194 udebug_thread_t udebug; 199 #endif /* CONFIG_UDEBUG */ 195 #endif 196 200 197 } thread_t; 201 198 … … 206 203 * 207 204 */ 208 IRQ_SPINLOCK_EXTERN(threads_lock);205 SPINLOCK_EXTERN(threads_lock); 209 206 210 207 /** AVL tree containing all threads. */ … … 212 209 213 210 extern void thread_init(void); 214 extern thread_t *thread_create(void (*)(void *), void *, task_t *, 215 unsigned int,const char *, bool);211 extern thread_t *thread_create(void (*)(void *), void *, task_t *, int, 212 const char *, bool); 216 213 extern void thread_attach(thread_t *, task_t *); 217 214 extern void thread_ready(thread_t *); … … 221 218 extern void thread_create_arch(thread_t *); 222 219 #endif 223 224 220 #ifndef thr_constructor_arch 225 221 extern void thr_constructor_arch(thread_t *); 226 222 #endif 227 228 223 #ifndef thr_destructor_arch 229 224 extern void thr_destructor_arch(thread_t *); … … 235 230 #define thread_join(t) \ 236 231 thread_join_timeout((t), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) 237 238 extern int thread_join_timeout(thread_t *, uint32_t, unsigned int); 232 extern int thread_join_timeout(thread_t *, uint32_t, int); 239 233 extern void thread_detach(thread_t *); 240 234 241 235 extern void thread_register_call_me(void (*)(void *), void *); 242 236 extern void thread_print_list(void); 243 extern void thread_destroy(thread_t * , bool);237 extern void thread_destroy(thread_t *); 244 238 extern thread_t *thread_find_by_id(thread_id_t); 245 239 extern void thread_update_accounting(bool);
Note:
See TracChangeset
for help on using the changeset viewer.