summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
-rw-r--r--thread_pthread.c21
1 files changed, 16 insertions, 5 deletions
@@ -1964,7 +1964,7 @@ reserve_stack(volatile char *limit, size_t size)
#undef ruby_init_stack
void
-ruby_init_stack(volatile VALUE *addr)
{
native_main_thread.id = pthread_self();
@@ -2049,7 +2049,7 @@ ruby_init_stack(volatile VALUE *addr)
{int err = (expr); if (err) {rb_bug_errno(#expr, err);}}
static int
-native_thread_init_stack(rb_thread_t *th)
{
rb_nativethread_id_t curr = pthread_self();
@@ -2064,8 +2064,8 @@ native_thread_init_stack(rb_thread_t *th)
size_t size;
if (get_stack(&start, &size) == 0) {
- uintptr_t diff = (uintptr_t)start - (uintptr_t)&curr;
- th->ec->machine.stack_start = (VALUE *)&curr;
th->ec->machine.stack_maxsize = size - diff;
}
}
@@ -2185,8 +2185,19 @@ native_thread_create_dedicated(rb_thread_t *th)
static void
call_thread_start_func_2(rb_thread_t *th)
{
- native_thread_init_stack(th);
thread_start_func_2(th, th->ec->machine.stack_start);
}
static void *