this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use Darling reserved key definitions from libpthread

+7 -6
+1
Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/darling/emulation/tsd.h
··· 1 + ../../../../../../../../../../src/external/xnu/darling/src/libsystem_kernel/emulation/linux/tsd.h
+6 -6
src/xtrace/tls.cpp
··· 27 27 }; 28 28 29 29 // since we still need to handle some calls after pthread_terminate is called and libpthread unwinds its TLS right before calling pthread_terminate, 30 - // we have to use a slightly hackier technique: using one of the system's reserved but unused TLS keys. 31 - // key 200 seems like a good fit; it's in the reserved region but it's not currently listed in `pthread/tsd_private.h` as being in-use by anything. 30 + // we have to use a slightly hackier technique: using one of the system's reserved but unused TLS keys; we use one from the range we currently reserve 31 + // for Darling. 32 32 33 - #define __PTK_XTRACE_TLS 200 33 + #include <darling/emulation/tsd.h> 34 34 35 35 // TODO: also perform TLS cleanup for other threads when doing a fork 36 36 37 37 extern "C" 38 38 void xtrace_tls_thread_cleanup(void) { 39 - tls_table_t table = (tls_table_t)_pthread_getspecific_direct(__PTK_XTRACE_TLS); 39 + tls_table_t table = (tls_table_t)_pthread_getspecific_direct(__PTK_DARLING_XTRACE_TLS); 40 40 if (!table) { 41 41 xtrace_tls_debug("no table to cleanup for this thread"); 42 42 return; ··· 58 58 void* xtrace_tls(void* key, size_t size, bool* created, xtrace_tls_destructor_f destructor) { 59 59 xtrace_tls_debug("looking up tls variable for key %p", key); 60 60 61 - tls_table_t table = (tls_table_t)_pthread_getspecific_direct(__PTK_XTRACE_TLS); 61 + tls_table_t table = (tls_table_t)_pthread_getspecific_direct(__PTK_DARLING_XTRACE_TLS); 62 62 63 63 xtrace_tls_debug("got %p as table pointer from pthread", table); 64 64 ··· 70 70 xtrace_abort("xtrace: failed TLS table memory allocation"); 71 71 } 72 72 table->size = 0; 73 - _pthread_setspecific_direct(__PTK_XTRACE_TLS, table); 73 + _pthread_setspecific_direct(__PTK_DARLING_XTRACE_TLS, table); 74 74 } 75 75 76 76 // check if the key is already present