Rev 1600 | Rev 1661 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1600 | Rev 1636 | ||
---|---|---|---|
Line 53... | Line 53... | ||
53 | 53 | ||
54 | #ifndef LOADED_PROG_STACK_PAGES_NO |
54 | #ifndef LOADED_PROG_STACK_PAGES_NO |
55 | #define LOADED_PROG_STACK_PAGES_NO 1 |
55 | #define LOADED_PROG_STACK_PAGES_NO 1 |
56 | #endif |
56 | #endif |
57 | 57 | ||
- | 58 | /** Spinlock protecting the tasks_btree B+tree. */ |
|
58 | SPINLOCK_INITIALIZE(tasks_lock); |
59 | SPINLOCK_INITIALIZE(tasks_lock); |
- | 60 | ||
- | 61 | /** B+tree of active tasks. |
|
- | 62 | * |
|
- | 63 | * The task is guaranteed to exist after it was found in the tasks_btree as long as: |
|
- | 64 | * @li the tasks_lock is held, |
|
- | 65 | * @li the task's lock is held when task's lock is acquired before releasing tasks_lock or |
|
- | 66 | * @li the task's refcount is grater than 0 |
|
- | 67 | * |
|
- | 68 | */ |
|
59 | btree_t tasks_btree; |
69 | btree_t tasks_btree; |
- | 70 | ||
60 | static task_id_t task_counter = 0; |
71 | static task_id_t task_counter = 0; |
61 | 72 | ||
62 | static void ktaskclnp(void *arg); |
73 | static void ktaskclnp(void *arg); |
63 | static void ktaskkill(void *arg); |
74 | static void ktaskkill(void *arg); |
64 | 75 | ||
Line 237... | Line 248... | ||
237 | /** Find task structure corresponding to task ID. |
248 | /** Find task structure corresponding to task ID. |
238 | * |
249 | * |
239 | * The tasks_lock must be already held by the caller of this function |
250 | * The tasks_lock must be already held by the caller of this function |
240 | * and interrupts must be disabled. |
251 | * and interrupts must be disabled. |
241 | * |
252 | * |
242 | * The task is guaranteed to exist after it was found in the tasks_btree as long as: |
- | |
243 | * @li the tasks_lock is held, |
- | |
244 | * @li the task's lock is held when task's lock is acquired before releasing tasks_lock or |
- | |
245 | * @li the task's refcount is grater than 0 |
- | |
246 | * |
- | |
247 | * @param id Task ID. |
253 | * @param id Task ID. |
248 | * |
254 | * |
249 | * @return Task structure address or NULL if there is no such task ID. |
255 | * @return Task structure address or NULL if there is no such task ID. |
250 | */ |
256 | */ |
251 | task_t *task_find_by_id(task_id_t id) |
257 | task_t *task_find_by_id(task_id_t id) |