1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

thread_pthread.c: Use getpagesize() when pthread_attr_getguardsize is unavailable

This is also for emscripten.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2018-02-15 01:59:16 +00:00
parent 8df47f8c8d
commit 50700c4d3c
2 changed files with 5 additions and 1 deletions

View file

@ -2290,7 +2290,7 @@ AS_IF([test x"$enable_pthread" = xyes], [
AC_DEFINE(NON_SCALAR_THREAD_ID)
])
AC_CHECK_FUNCS(sched_yield pthread_attr_setinheritsched \
pthread_attr_get_np pthread_attr_getstack \
pthread_attr_get_np pthread_attr_getstack pthread_attr_getguardsize \
pthread_get_stackaddr_np pthread_get_stacksize_np \
thr_stksegment pthread_stackseg_np pthread_getthrds_np \
pthread_condattr_setclock \

View file

@ -561,8 +561,12 @@ get_stack(void **addr, size_t *size)
CHECK_ERR(pthread_attr_getstackaddr(&attr, addr));
CHECK_ERR(pthread_attr_getstacksize(&attr, size));
# endif
# ifdef HAVE_PTHREAD_ATTR_GETGUARDSIZE
CHECK_ERR(pthread_attr_getguardsize(&attr, &guard));
*size -= guard;
# else
*size -= getpagesize();
# endif
pthread_attr_destroy(&attr);
#elif defined HAVE_PTHREAD_ATTR_GET_NP /* FreeBSD, DragonFly BSD, NetBSD */
pthread_attr_t attr;