Rev 2451 | Rev 2487 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2451 | Rev 2470 | ||
---|---|---|---|
Line 383... | Line 383... | ||
383 | * It is safe to destroy the task. |
383 | * It is safe to destroy the task. |
384 | */ |
384 | */ |
385 | if (atomic_predec(&t->task->refcount) == 0) |
385 | if (atomic_predec(&t->task->refcount) == 0) |
386 | task_destroy(t->task); |
386 | task_destroy(t->task); |
387 | 387 | ||
388 | /* |
- | |
389 | * If the thread had a userspace context, free up its kernel_uarg |
- | |
390 | * structure. |
- | |
391 | */ |
- | |
392 | if (t->flags & THREAD_FLAG_USPACE) { |
- | |
393 | ASSERT(t->thread_arg); |
- | |
394 | free(t->thread_arg); |
- | |
395 | } |
- | |
396 | - | ||
397 | slab_free(thread_slab, t); |
388 | slab_free(thread_slab, t); |
398 | } |
389 | } |
399 | 390 | ||
400 | /** Make the thread visible to the system. |
391 | /** Make the thread visible to the system. |
401 | * |
392 | * |
Line 680... | Line 671... | ||
680 | 671 | ||
681 | rc = copy_from_uspace(namebuf, uspace_name, THREAD_NAME_BUFLEN); |
672 | rc = copy_from_uspace(namebuf, uspace_name, THREAD_NAME_BUFLEN); |
682 | if (rc != 0) |
673 | if (rc != 0) |
683 | return (unative_t) rc; |
674 | return (unative_t) rc; |
684 | 675 | ||
- | 676 | /* |
|
- | 677 | * In case of failure, kernel_uarg will be deallocated in this function. |
|
- | 678 | * In case of success, kernel_uarg will be freed in uinit(). |
|
- | 679 | */ |
|
685 | kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0); |
680 | kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0); |
- | 681 | ||
686 | rc = copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t)); |
682 | rc = copy_from_uspace(kernel_uarg, uspace_uarg, sizeof(uspace_arg_t)); |
687 | if (rc != 0) { |
683 | if (rc != 0) { |
688 | free(kernel_uarg); |
684 | free(kernel_uarg); |
689 | return (unative_t) rc; |
685 | return (unative_t) rc; |
690 | } |
686 | } |