summaryrefslogtreecommitdiff
path: root/thread_pthread.ci
diff options
context:
space:
mode:
Diffstat (limited to 'thread_pthread.ci')
-rw-r--r--thread_pthread.ci13
1 files changed, 10 insertions, 3 deletions
diff --git a/thread_pthread.ci b/thread_pthread.ci
index 2896e3213b..c2c9d9967f 100644
--- a/thread_pthread.ci
+++ b/thread_pthread.ci
@@ -179,16 +179,19 @@ native_thread_create(yarv_thread_t *th)
}
else {
pthread_attr_t attr;
- size_t stack_size = 512 * 1024 - sizeof(int); /* 512KB */
+#ifdef PTHREAD_STACK_MIN
+ size_t stack_size = 512 * 1024 - sizeof(int); /* 512KB */
if (stack_size < PTHREAD_STACK_MIN) {
stack_size = PTHREAD_STACK_MIN * 2;
}
-
- thread_debug("create: %p, stack size: %ld\n", th, stack_size);
+#endif
+ thread_debug("create: %p, stack size: %ld\n", th, stack_size);
pthread_attr_init(&attr);
+#ifdef PTHREAD_STACK_MIN
pthread_attr_setstacksize(&attr, stack_size);
+#endif
pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
@@ -416,12 +419,16 @@ rb_thread_create_timer_thread(void)
rb_enable_interrupt();
if (!timer_thread_id) {
+#ifdef PTHREAD_STACK_MIN
size_t stack_size = PTHREAD_STACK_MIN;
+#endif
pthread_attr_t attr;
int err;
pthread_attr_init(&attr);
+#ifdef PTHREAD_STACK_MIN
pthread_attr_setstacksize(&attr, stack_size);
+#endif
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
err = pthread_create(&timer_thread_id, &attr, thread_timer, 0);
if (err != 0) {