Ticket #7235: pthread.diff

File pthread.diff, 1.6 KB (added by korli, 9 years ago)

init thread id so that it can be used by pthread_kill()

  • headers/private/libroot/libroot_private.h

     
    4141void __reinit_pwd_backend_after_fork(void);
    4242void* __arch_get_caller(void);
    4343
     44void __init_pthread(void);
    4445
     46
    4547#ifdef __cplusplus
    4648}
    4749#endif
  • src/system/libroot/posix/pthread/pthread.c

     
    2929};
    3030
    3131
     32void __init_pthread(void);
    3233static pthread_thread sMainThread;
    3334static int sConcurrencyLevel;
    3435
     
    9394}
    9495
    9596
     97void
     98__init_pthread(void)
     99{
     100    sMainThread.id = find_thread(NULL);
     101}
     102
     103
    96104// #pragma mark - public API
    97105
    98106
  • src/system/libroot/os/thread.c

     
    9999    attributes.stack_address = NULL;
    100100    attributes.stack_size = 0;
    101101
    102     return _kern_spawn_thread(&attributes);
     102    thread->id = _kern_spawn_thread(&attributes);
     103    return thread->id;
    103104}
    104105
    105106
  • src/system/libroot/libroot_init.c

     
    6060    __init_env(__gRuntimeLoader->program_args);
    6161    __init_heap_post_env();
    6262    __init_pwd_backend();
     63    __init_pthread();
    6364}
    6465
    6566