Changeset ea7890e7 in mainline for kernel/generic/src/main/uinit.c


Ignore:
Timestamp:
2007-06-01T15:47:46Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
07be3c4
Parents:
ff3a34b
Message:

More efficient and simpler task termination.

Based on the assumption, that after its creation, only the task itself can create more threads for itself,
the last thread with userspace context to execute thread_exit() will perform futex and IPC cleanup. When
the task has no threads, it is destroyed. Both the cleanup and destruction is controlled by reference
counting.

As for userspace threads, even though there could be a global garbage collector for joining threads, it is
much simpler if the uinit thread detaches itself before switching to userspace.

task_kill() is now an idempotent operation. It just instructs the threads within a task to exit.

Change in the name of a thread state: Undead → JoinMe.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/main/uinit.c

    rff3a34b rea7890e7  
    4646#include <userspace.h>
    4747#include <mm/slab.h>
     48#include <arch.h>
    4849
    4950/** Thread used to bring up userspace thread.
     
    5556{
    5657        uspace_arg_t uarg;
     58
     59        /*
     60         * So far, we don't have a use for joining userspace threads so we
     61         * immediately detach each uinit thread. If joining of userspace threads
     62         * is required, some userspace API based on the kernel mechanism will
     63         * have to be implemented. Moreover, garbage collecting of threads that
     64         * didn't detach themselves and nobody else joined them will have to be
     65         * deployed for the event of forceful task termination.
     66         */
     67        thread_detach(THREAD);
    5768       
    5869        uarg.uspace_entry = ((uspace_arg_t *) arg)->uspace_entry;
    5970        uarg.uspace_stack = ((uspace_arg_t *) arg)->uspace_stack;
    6071        uarg.uspace_uarg = ((uspace_arg_t *) arg)->uspace_uarg;
    61         uarg.uspace_thread_function = NULL;
    62         uarg.uspace_thread_arg = NULL;
     72        uarg.uspace_thread_function = NULL; uarg.uspace_thread_arg = NULL;
    6373
    6474        free((uspace_arg_t *) arg);
Note: See TracChangeset for help on using the changeset viewer.