- if (__set_thread_area(TP_ADJ(p)) < 0)
- return -1;
- td->tid = td->pid = __syscall(SYS_set_tid_address, &td->tid);
- td->errno_ptr = &td->errno_val;
- /* Currently, both of these predicates depend in the same thing:
- * successful initialization of the thread pointer. However, in
- * the future, we may support setups where setting the thread
- * pointer is possible but threads other than the main thread
- * cannot work, so it's best to keep the predicates separate. */
- libc.has_thread_pointer = 1;
- libc.can_do_threads = 1;
+ int r = __set_thread_area(TP_ADJ(p));
+ if (r < 0) return -1;
+ if (!r) libc.can_do_threads = 1;
+ td->detach_state = DT_JOINABLE;
+ td->tid = __syscall(SYS_set_tid_address, &td->detach_state);
+ td->locale = &libc.global_locale;
+ td->robust_list.head = &td->robust_list.head;