Rev 557 | Rev 624 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 557 | Rev 623 | ||
|---|---|---|---|
| Line 52... | Line 52... | ||
| 52 | #include <arch/atomic.h> |
52 | #include <arch/atomic.h> |
| 53 | #include <memstr.h> |
53 | #include <memstr.h> |
| 54 | 54 | ||
| 55 | char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */ |
55 | char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */ |
| 56 | 56 | ||
| 57 | spinlock_t threads_lock; /**< Lock protecting threads_head list. For locking rules, see declaration thereof. */ |
57 | SPINLOCK_INITIALIZE(threads_lock); /**< Lock protecting threads_head list. For locking rules, see declaration thereof. */ |
| 58 | link_t threads_head; /**< List of all threads. */ |
58 | link_t threads_head; /**< List of all threads. */ |
| 59 | 59 | ||
| 60 | static spinlock_t tidlock; |
60 | SPINLOCK_INITIALIZE(tidlock); |
| 61 | __u32 last_tid = 0; |
61 | __u32 last_tid = 0; |
| 62 | 62 | ||
| 63 | 63 | ||
| 64 | /** Thread wrapper |
64 | /** Thread wrapper |
| 65 | * |
65 | * |
| Line 94... | Line 94... | ||
| 94 | */ |
94 | */ |
| 95 | void thread_init(void) |
95 | void thread_init(void) |
| 96 | { |
96 | { |
| 97 | THREAD = NULL; |
97 | THREAD = NULL; |
| 98 | nrdy = 0; |
98 | nrdy = 0; |
| 99 | spinlock_initialize(&threads_lock, "threads_lock"); |
- | |
| 100 | list_initialize(&threads_head); |
99 | list_initialize(&threads_head); |
| 101 | } |
100 | } |
| 102 | 101 | ||
| 103 | 102 | ||
| 104 | /** Make thread ready |
103 | /** Make thread ready |