We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 35fee1d commit 5a255d5Copy full SHA for 5a255d5
libc-top-half/musl/src/env/__init_tls.c
@@ -70,6 +70,18 @@ int __init_tp(void *p)
70
td->tid = __syscall(SYS_set_tid_address, &__thread_list_lock);
71
#else
72
setup_default_stack_size();
73
+ td->detach_state = DT_JOINABLE;
74
+ /*
75
+ * Initialize the TID to a value which doesn't conflict with
76
+ * host-allocated TIDs, so that TID-based locks can work.
77
+ *
78
+ * Note:
79
+ * - Host-allocated TIDs range from 1 to 0x1fffffff. (inclusive)
80
+ * - __tl_lock and __lockfile uses TID 0 as "unlocked".
81
+ * - __lockfile relies on the fact the most significant two bits
82
+ * of TIDs are 0.
83
+ */
84
+ td->tid = 0x3fffffff;
85
#endif
86
td->locale = &libc.global_locale;
87
td->robust_list.head = &td->robust_list.head;
0 commit comments