Rev 1587 | Rev 1589 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1587 | Rev 1588 | ||
---|---|---|---|
Line 138... | Line 138... | ||
138 | * |
138 | * |
139 | * @param t Task to be destroyed. |
139 | * @param t Task to be destroyed. |
140 | */ |
140 | */ |
141 | void task_destroy(task_t *t) |
141 | void task_destroy(task_t *t) |
142 | { |
142 | { |
143 | spinlock_lock(&tasks_lock); |
- | |
144 | btree_remove(&tasks_btree, t->taskid, NULL); |
- | |
145 | spinlock_unlock(&tasks_lock); |
- | |
146 | - | ||
147 | task_destroy_arch(t); |
143 | task_destroy_arch(t); |
148 | btree_destroy(&t->futexes); |
144 | btree_destroy(&t->futexes); |
149 | 145 | ||
150 | mutex_lock_active(&t->as->lock); |
146 | mutex_lock_active(&t->as->lock); |
151 | if (--t->as->refcount == 0) { |
147 | if (--t->as->refcount == 0) { |
Line 272... | Line 268... | ||
272 | if (!(ta = task_find_by_id(id))) { |
268 | if (!(ta = task_find_by_id(id))) { |
273 | spinlock_unlock(&tasks_lock); |
269 | spinlock_unlock(&tasks_lock); |
274 | interrupts_restore(ipl); |
270 | interrupts_restore(ipl); |
275 | return ENOENT; |
271 | return ENOENT; |
276 | } |
272 | } |
277 | 273 | ||
278 | spinlock_lock(&ta->lock); |
274 | spinlock_lock(&ta->lock); |
279 | ta->refcount++; |
275 | ta->refcount++; |
280 | spinlock_unlock(&ta->lock); |
276 | spinlock_unlock(&ta->lock); |
281 | 277 | ||
- | 278 | btree_remove(&tasks_btree, ta->taskid, NULL); |
|
282 | spinlock_unlock(&tasks_lock); |
279 | spinlock_unlock(&tasks_lock); |
283 | 280 | ||
284 | t = thread_create(ktaskclnp, NULL, ta, 0, "ktaskclnp"); |
281 | t = thread_create(ktaskclnp, NULL, ta, 0, "ktaskclnp"); |
285 | 282 | ||
286 | spinlock_lock(&ta->lock); |
283 | spinlock_lock(&ta->lock); |