Rev 2268 | Rev 2440 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2268 | Rev 2436 | ||
---|---|---|---|
Line 297... | Line 297... | ||
297 | spinlock_unlock(&t->task->lock); |
297 | spinlock_unlock(&t->task->lock); |
298 | 298 | ||
299 | if (destroy_task) |
299 | if (destroy_task) |
300 | task_destroy(t->task); |
300 | task_destroy(t->task); |
301 | 301 | ||
- | 302 | /* |
|
- | 303 | * If the thread had a userspace context, free up its kernel_uarg |
|
- | 304 | * structure. |
|
- | 305 | */ |
|
- | 306 | if (t->flags & THREAD_FLAG_USPACE) { |
|
- | 307 | ASSERT(t->thread_arg); |
|
- | 308 | free(t->thread_arg); |
|
- | 309 | } |
|
- | 310 | ||
302 | slab_free(thread_slab, t); |
311 | slab_free(thread_slab, t); |
303 | } |
312 | } |
304 | 313 | ||
305 | /** Create new thread |
314 | /** Create new thread |
306 | * |
315 | * |
Line 635... | Line 644... | ||
635 | } |
644 | } |
636 | 645 | ||
637 | /** Process syscall to create new thread. |
646 | /** Process syscall to create new thread. |
638 | * |
647 | * |
639 | */ |
648 | */ |
640 | unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, thread_id_t *uspace_thread_id) |
649 | unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, |
- | 650 | thread_id_t *uspace_thread_id) |
|
641 | { |
651 | { |
642 | thread_t *t; |
652 | thread_t *t; |
643 | char namebuf[THREAD_NAME_BUFLEN]; |
653 | char namebuf[THREAD_NAME_BUFLEN]; |
644 | uspace_arg_t *kernel_uarg; |
654 | uspace_arg_t *kernel_uarg; |
645 | int rc; |
655 | int rc; |
Line 658... | Line 668... | ||
658 | t = thread_create(uinit, kernel_uarg, TASK, THREAD_FLAG_USPACE, namebuf, |
668 | t = thread_create(uinit, kernel_uarg, TASK, THREAD_FLAG_USPACE, namebuf, |
659 | false); |
669 | false); |
660 | if (t) { |
670 | if (t) { |
661 | thread_ready(t); |
671 | thread_ready(t); |
662 | if (uspace_thread_id != NULL) |
672 | if (uspace_thread_id != NULL) |
663 | return (unative_t) copy_to_uspace(uspace_thread_id, &t->tid, |
673 | return (unative_t) copy_to_uspace(uspace_thread_id, |
664 | sizeof(t->tid)); |
674 | &t->tid, sizeof(t->tid)); |
665 | else |
675 | else |
666 | return 0; |
676 | return 0; |
667 | } else |
677 | } else |
668 | free(kernel_uarg); |
678 | free(kernel_uarg); |
669 | 679 |