Changeset 29a9f62 in mainline for libc/generic/thread.c


Ignore:
Timestamp:
2006-03-23T10:33:55Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77bd004
Parents:
1cef26f
Message:

Added symbolic links 'libarch','libadt','libipc' into libc/include,
so that it can be easily used from anywhere.
Renamed thread_main to thread_main.
Allowed MIPS to compile with -O0.
Added non-preemptible threads support (not yet secured by futexes).
Added simple way to hold Thread Local Storage. Support for compiler
will be added later.
This update breaks IA64 uspace.

There is some forgotten spinlock_lock() in futexes, amd64 gets locked
in the secod uspace thread probably with preemption disabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libc/generic/thread.c

    r1cef26f r29a9f62  
    3232#include <arch/faddr.h>
    3333#include <kernel/proc/uarg.h>
     34#include <psthread.h>
     35
     36#include <stdio.h>
     37void * __make_tls(void)
     38{
     39        psthread_data_t *pt;
     40
     41        pt = malloc(sizeof(psthread_data_t));
     42        pt->self = pt;
     43
     44        return pt;
     45}
     46
     47void __free_tls(void *tls)
     48{
     49        free(tls);
     50}
    3451
    3552/** Main thread function.
     
    4259 * @param uarg Pointer to userspace argument structure.
    4360 */
    44 void thread_main(uspace_arg_t *uarg)
     61void __thread_main(uspace_arg_t *uarg)
    4562{
     63        /* This should initialize the area according to TLS specicification */
     64        __tls_set(__make_tls());
     65
    4666        uarg->uspace_thread_function(uarg->uspace_thread_arg);
    4767        free(uarg->uspace_stack);
    4868        free(uarg);
     69
     70        __free_tls(__tls_get());
     71
    4972        thread_exit(0);
    5073}
Note: See TracChangeset for help on using the changeset viewer.