Merge "Add __libc_add_main_thread and mark it weak"
This commit is contained in:
commit
67b5979930
|
@ -46,6 +46,7 @@
|
|||
#include "private/KernelArgumentBlock.h"
|
||||
#include "private/WriteProtected.h"
|
||||
#include "private/bionic_auxv.h"
|
||||
#include "private/bionic_defs.h"
|
||||
#include "private/bionic_globals.h"
|
||||
#include "private/bionic_tls.h"
|
||||
#include "private/thread_private.h"
|
||||
|
@ -107,6 +108,13 @@ static void arc4random_fork_handler() {
|
|||
_thread_arc4_lock();
|
||||
}
|
||||
|
||||
__BIONIC_WEAK_FOR_NATIVE_BRIDGE
|
||||
void __libc_add_main_thread() {
|
||||
// Get the main thread from TLS and add it to the thread list.
|
||||
pthread_internal_t* main_thread = __get_thread();
|
||||
__pthread_internal_add(main_thread);
|
||||
}
|
||||
|
||||
void __libc_init_common(KernelArgumentBlock& args) {
|
||||
// Initialize various globals.
|
||||
environ = args.envp;
|
||||
|
@ -118,9 +126,7 @@ void __libc_init_common(KernelArgumentBlock& args) {
|
|||
__check_max_thread_id();
|
||||
#endif
|
||||
|
||||
// Get the main thread from TLS and add it to the thread list.
|
||||
pthread_internal_t* main_thread = __get_thread();
|
||||
__pthread_internal_add(main_thread);
|
||||
__libc_add_main_thread();
|
||||
|
||||
// Register atfork handlers to take and release the arc4random lock.
|
||||
pthread_atfork(arc4random_fork_handler, _thread_arc4_unlock, _thread_arc4_unlock);
|
||||
|
|
Loading…
Reference in New Issue