summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-23 04:39:02 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-23 04:39:02 +0000
commite5481ccd8e6470b05d0c8a202103dc307c4aa25f (patch)
treef425ba0c484828af60f4d21a085515336f2ed202 /thread_pthread.c
parentfa30ebc3c7536e0e766abbe52c24b732f83ad3b4 (diff)
* thread_pthread.c (ruby_init_stack): ignore `STACK_END_ADDRESS'
if Ruby interpreter is running on co-routine. [Feature #2294] https://bugs.ruby-lang.org/issues/2294#note-18 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 6c48224a87..6e5f53fa67 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -643,6 +643,27 @@ ruby_init_stack(volatile VALUE *addr
native_main_thread.stack_maxsize = space;
#endif
}
+
+ /* If addr is out of range of main-thread stack range estimation, */
+ /* it should be on co-routine (alternative stack). [Feature #2294] */
+ {
+ void *start, *end;
+
+ if (IS_STACK_DIR_UPPER()) {
+ start = native_main_thread.stack_start;
+ end = (char *)native_main_thread.stack_start + native_main_thread.stack_maxsize;
+ }
+ else {
+ start = (char *)native_main_thread.stack_start - native_main_thread.stack_maxsize;
+ end = native_main_thread.stack_start;
+ }
+
+ if ((void *)addr < start || (void *)addr > end) {
+ /* out of range */
+ native_main_thread.stack_start = (VALUE *)addr;
+ native_main_thread.stack_maxsize = 0; /* unknown */
+ }
+ }
}
#define CHECK_ERR(expr) \