summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-20 21:38:27 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-20 21:38:27 (GMT)
commit475b4aa40b6cf83e57176a063d368d55bf779e7c (patch)
tree569c6a6db871c4e762b293038ed456afbcf36c1c /thread_pthread.c
parente72a86fc9373e4477b6e275735fecdf4eac9944a (diff)
simplify altstack and enable reuse with thread cache
Instead of allocating and registering the altstack in different places, do it together to reduce code and improve readability. When thread cache is enabled, storing altstack in rb_thread_t is wasteful and we may reuse altstack in the same pthread. This also lets us clearly allow use of xmalloc to allow GC to recover from ENOMEM. [ruby-core:85621] [Feature #14487] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 951885f..43766b2 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -840,6 +840,7 @@ static void *
thread_start_func_1(void *th_ptr)
{
rb_thread_t *th = th_ptr;
+ RB_ALTSTACK_INIT(void *altstack);
#if USE_THREAD_CACHE
thread_start:
#endif
@@ -868,6 +869,7 @@ thread_start_func_1(void *th_ptr)
}
}
#endif
+ RB_ALTSTACK_FREE(altstack);
return 0;
}