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 ab1971f commit 98688e1Copy full SHA for 98688e1
libc-top-half/musl/src/env/__init_tls.c
@@ -82,6 +82,18 @@ int __init_tp(void *p)
82
td->tid = __syscall(SYS_set_tid_address, &__thread_list_lock);
83
#else
84
setup_default_stack_size();
85
+ td->detach_state = DT_JOINABLE;
86
+ /*
87
+ * Initialize the TID to a value which doesn't conflict with
88
+ * host-allocated TIDs, so that TID-based locks can work.
89
+ *
90
+ * Note:
91
+ * - Host-allocated TIDs range from 1 to 0x1fffffff. (inclusive)
92
+ * - __tl_lock and __lockfile uses TID 0 as "unlocked".
93
+ * - __lockfile relies on the fact the most significant two bits
94
+ * of TIDs are 0.
95
+ */
96
+ td->tid = 0x3fffffff;
97
#endif
98
td->locale = &libc.global_locale;
99
td->robust_list.head = &td->robust_list.head;
0 commit comments