fix(util/stackinfo): on OSX Boost does not seem to be based on pthread library
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
7124866a4f
commit
fb5c7c8e92
1 changed files with 16 additions and 9 deletions
|
@ -43,16 +43,23 @@ size_t get_stack_size(int main) {
|
||||||
return curr.rlim_max;
|
return curr.rlim_max;
|
||||||
} else {
|
} else {
|
||||||
#if defined(LEAN_MULTI_THREAD)
|
#if defined(LEAN_MULTI_THREAD)
|
||||||
// This branch retrieves the default thread size for pthread threads.
|
{
|
||||||
// This is *not* the stack size of the main thread.
|
#if defined(LEAN_USE_BOOST)
|
||||||
pthread_attr_t attr;
|
// Boost does seems to be based on pthread on OSX
|
||||||
memset (&attr, 0, sizeof(attr));
|
return get_thread_attributes().get_stack_size();
|
||||||
pthread_attr_init(&attr);
|
#else
|
||||||
size_t result;
|
// This branch retrieves the default thread size for pthread threads.
|
||||||
if (pthread_attr_getstacksize(&attr, &result) != 0) {
|
// This is *not* the stack size of the main thread.
|
||||||
throw_get_stack_size_failed();
|
pthread_attr_t attr;
|
||||||
|
memset (&attr, 0, sizeof(attr));
|
||||||
|
pthread_attr_init(&attr);
|
||||||
|
size_t result;
|
||||||
|
if (pthread_attr_getstacksize(&attr, &result) != 0) {
|
||||||
|
throw_get_stack_size_failed();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue