Rev 4348 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4348 | Rev 4691 | ||
---|---|---|---|
Line 52... | Line 52... | ||
52 | #include <print.h> |
52 | #include <print.h> |
53 | #include <errno.h> |
53 | #include <errno.h> |
54 | #include <func.h> |
54 | #include <func.h> |
55 | #include <string.h> |
55 | #include <string.h> |
56 | #include <syscall/copy.h> |
56 | #include <syscall/copy.h> |
- | 57 | #include <macros.h> |
|
- | 58 | #include <ipc/event.h> |
|
57 | 59 | ||
58 | /** Spinlock protecting the tasks_tree AVL tree. */ |
60 | /** Spinlock protecting the tasks_tree AVL tree. */ |
59 | SPINLOCK_INITIALIZE(tasks_lock); |
61 | SPINLOCK_INITIALIZE(tasks_lock); |
60 | 62 | ||
61 | /** AVL tree of active tasks. |
63 | /** AVL tree of active tasks. |
Line 194... | Line 196... | ||
194 | avltree_node_initialize(&ta->tasks_tree_node); |
196 | avltree_node_initialize(&ta->tasks_tree_node); |
195 | ta->tasks_tree_node.key = ta->taskid; |
197 | ta->tasks_tree_node.key = ta->taskid; |
196 | avltree_insert(&tasks_tree, &ta->tasks_tree_node); |
198 | avltree_insert(&tasks_tree, &ta->tasks_tree_node); |
197 | spinlock_unlock(&tasks_lock); |
199 | spinlock_unlock(&tasks_lock); |
198 | interrupts_restore(ipl); |
200 | interrupts_restore(ipl); |
199 | 201 | ||
- | 202 | /* |
|
- | 203 | * Notify about task creation. |
|
- | 204 | */ |
|
- | 205 | if (event_is_subscribed(EVENT_WAIT)) |
|
- | 206 | event_notify_3(EVENT_WAIT, TASK_CREATE, LOWER32(ta->taskid), |
|
- | 207 | UPPER32(ta->taskid)); |
|
- | 208 | ||
200 | return ta; |
209 | return ta; |
201 | } |
210 | } |
202 | 211 | ||
203 | /** Destroy task. |
212 | /** Destroy task. |
204 | * |
213 | * |
Line 227... | Line 236... | ||
227 | * Drop our reference to the address space. |
236 | * Drop our reference to the address space. |
228 | */ |
237 | */ |
229 | if (atomic_predec(&t->as->refcount) == 0) |
238 | if (atomic_predec(&t->as->refcount) == 0) |
230 | as_destroy(t->as); |
239 | as_destroy(t->as); |
231 | 240 | ||
- | 241 | /* |
|
- | 242 | * Notify about task destruction. |
|
- | 243 | */ |
|
- | 244 | if (event_is_subscribed(EVENT_WAIT)) |
|
- | 245 | event_notify_3(EVENT_WAIT, TASK_DESTROY, LOWER32(t->taskid), |
|
- | 246 | UPPER32(t->taskid)); |
|
- | 247 | ||
232 | free(t); |
248 | free(t); |
233 | TASK = NULL; |
249 | TASK = NULL; |
234 | } |
250 | } |
235 | 251 | ||
236 | /** Syscall for reading task ID from userspace. |
252 | /** Syscall for reading task ID from userspace. |