ruby-changes:50294
From: mame <ko1@a...>
Date: Thu, 15 Feb 2018 10:59:21 +0900 (JST)
Subject: [ruby-changes:50294] mame:r62409 (trunk): thread_pthread.c: Use `getpagesize()` when `pthread_attr_getguardsize` is unavailable
mame 2018-02-15 10:59:16 +0900 (Thu, 15 Feb 2018) New Revision: 62409 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62409 Log: thread_pthread.c: Use `getpagesize()` when `pthread_attr_getguardsize` is unavailable This is also for emscripten. Modified files: trunk/configure.ac trunk/thread_pthread.c Index: configure.ac =================================================================== --- configure.ac (revision 62408) +++ configure.ac (revision 62409) @@ -2290,7 +2290,7 @@ AS_IF([test x"$enable_pthread" = xyes], https://github.com/ruby/ruby/blob/trunk/configure.ac#L2290 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 \ Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 62408) +++ thread_pthread.c (revision 62409) @@ -561,8 +561,12 @@ get_stack(void **addr, size_t *size) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L561 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/