From d3559846d7c839dd63a0b5cfc981a7a53c6c9a4b Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 25 Dec 2017 22:20:41 -0500 Subject: [PATCH] Add musl libc definitions to: src_core_thread --- src/core/thread.d | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/thread.d b/src/core/thread.d index f69defca35..b08c4d5c67 100644 --- a/src/core/thread.d +++ b/src/core/thread.d @@ -3199,6 +3199,7 @@ extern (C) @nogc nothrow version (NetBSD) int pthread_attr_get_np(pthread_t thread, pthread_attr_t* attr); version (Solaris) int thr_stksegment(stack_t* stk); version (CRuntime_Bionic) int pthread_getattr_np(pthread_t thid, pthread_attr_t* attr); + version (CRuntime_Musl) int pthread_getattr_np(pthread_t, pthread_attr_t*); } @@ -3285,6 +3286,16 @@ private void* getStackBottom() nothrow @nogc pthread_attr_destroy(&attr); return addr + size; } + else version (CRuntime_Musl) + { + pthread_attr_t attr; + void* addr; size_t size; + + pthread_getattr_np(pthread_self(), &attr); + pthread_attr_getstack(&attr, &addr, &size); + pthread_attr_destroy(&attr); + return addr + size; + } else static assert(false, "Platform not supported."); }