mirror of
https://github.com/microsoft/mimalloc.git
synced 2024-12-27 13:33:18 +08:00
Merge pull request #384 from kdrag0n/fix-android-thread-id
Fix thread ID getter on Android ARM/AArch64
This commit is contained in:
commit
f941015928
@ -751,6 +751,9 @@ static inline uintptr_t _mi_thread_id(void) mi_attr_noexcept {
|
|||||||
#if defined(__aarch64__) && defined(__APPLE__) // M1
|
#if defined(__aarch64__) && defined(__APPLE__) // M1
|
||||||
// on macOS on the M1, slot 0 does not seem to work, so we fall back to portable C for now. See issue #354
|
// on macOS on the M1, slot 0 does not seem to work, so we fall back to portable C for now. See issue #354
|
||||||
return (uintptr_t)&_mi_heap_default;
|
return (uintptr_t)&_mi_heap_default;
|
||||||
|
#elif defined(__BIONIC__) && (defined(__arm__) || defined(__aarch64__))
|
||||||
|
// on Android, slot 1 is the thread ID (pointer to pthread internal struct)
|
||||||
|
return (uintptr_t)mi_tls_slot(1);
|
||||||
#else
|
#else
|
||||||
// in all our other targets, slot 0 is the pointer to the thread control block
|
// in all our other targets, slot 0 is the pointer to the thread control block
|
||||||
return (uintptr_t)mi_tls_slot(0);
|
return (uintptr_t)mi_tls_slot(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user