Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/thread.c

    rabf6c01 raae365bc  
    165165
    166166#ifdef CONFIG_FPU
    167         thread->saved_fpu_context = slab_alloc(fpu_context_cache,
    168             FRAME_ATOMIC | kmflags);
     167#ifdef CONFIG_FPU_LAZY
     168        thread->saved_fpu_context = NULL;
     169#else /* CONFIG_FPU_LAZY */
     170        thread->saved_fpu_context = slab_alloc(fpu_context_cache, kmflags);
    169171        if (!thread->saved_fpu_context)
    170172                return ENOMEM;
     173#endif /* CONFIG_FPU_LAZY */
    171174#endif /* CONFIG_FPU */
    172175
     
    197200        if (!stack_phys) {
    198201#ifdef CONFIG_FPU
    199                 assert(thread->saved_fpu_context);
    200                 slab_free(fpu_context_cache, thread->saved_fpu_context);
     202                if (thread->saved_fpu_context)
     203                        slab_free(fpu_context_cache, thread->saved_fpu_context);
    201204#endif
    202205                return ENOMEM;
     
    223226
    224227#ifdef CONFIG_FPU
    225         assert(thread->saved_fpu_context);
    226         slab_free(fpu_context_cache, thread->saved_fpu_context);
     228        if (thread->saved_fpu_context)
     229                slab_free(fpu_context_cache, thread->saved_fpu_context);
    227230#endif
    228231
     
    339342    thread_flags_t flags, const char *name)
    340343{
    341         thread_t *thread = (thread_t *) slab_alloc(thread_cache, FRAME_ATOMIC);
     344        thread_t *thread = (thread_t *) slab_alloc(thread_cache, 0);
    342345        if (!thread)
    343346                return NULL;
    344 
    345         if (thread_create_arch(thread, flags) != EOK) {
    346                 slab_free(thread_cache, thread);
    347                 return NULL;
    348         }
    349347
    350348        /* Not needed, but good for debugging */
     
    409407        udebug_thread_initialize(&thread->udebug);
    410408#endif
     409
     410        /* Might depend on previous initialization */
     411        thread_create_arch(thread);
    411412
    412413        if ((flags & THREAD_FLAG_NOATTACH) != THREAD_FLAG_NOATTACH)
     
    653654
    654655        return waitq_sleep_timeout(&thread->join_wq, usec, flags, NULL);
    655 
    656         // FIXME: join should deallocate the thread.
    657         //        Current code calls detach after join, that's contrary to how
    658         //        join is used in other threading APIs.
    659656}
    660657
Note: See TracChangeset for help on using the changeset viewer.