Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/thread.c

    r47b7006 r63f8966  
    3131 */
    3232/** @file
    33  */
     33 */ 
    3434
    3535#include <thread.h>
     
    4141#include <str.h>
    4242#include <async.h>
    43 #include "private/thread.h"
    4443
    4544#ifndef THREAD_INITIAL_STACK_PAGES_NO
     
    5150 * This function is called from __thread_entry() and is used
    5251 * to call the thread's implementing function and perform cleanup
    53  * and exit when thread returns back.
     52 * and exit when thread returns back. Do not call this function
     53 * directly.
    5454 *
    5555 * @param uarg Pointer to userspace argument structure.
    56  *
    5756 */
    5857void __thread_main(uspace_arg_t *uarg)
    5958{
    60         fibril_t *fibril = fibril_setup();
    61         if (fibril == NULL)
    62                 thread_exit(0);
    63        
    64         __tcb_set(fibril->tcb);
    65        
     59        fibril_t *f;
     60
     61        f = fibril_setup();
     62        __tcb_set(f->tcb);
     63
    6664        uarg->uspace_thread_function(uarg->uspace_thread_arg);
    67         /* XXX: we cannot free the userspace stack while running on it
    68                 free(uarg->uspace_stack);
    69                 free(uarg);
    70         */
    71        
     65        /* XXX: we cannot free the userspace stack while running on it */
     66//      free(uarg->uspace_stack);
     67//      free(uarg);
     68
    7269        /* If there is a manager, destroy it */
    7370        async_destroy_manager();
    74         fibril_teardown(fibril);
    75        
     71        fibril_teardown(f);
     72
    7673        thread_exit(0);
    7774}
     
    130127 *
    131128 * @param status Exit status. Currently not used.
    132  *
    133129 */
    134130void thread_exit(int status)
    135131{
    136132        __SYSCALL1(SYS_THREAD_EXIT, (sysarg_t) status);
    137        
    138         /* Unreachable */
    139         while (1);
     133        for (;;)
     134                ;
    140135}
    141136
Note: See TracChangeset for help on using the changeset viewer.