[前][次][番号順一覧][スレッド一覧]

ruby-changes:71940

From: Koichi <ko1@a...>
Date: Tue, 24 May 2022 17:51:02 +0900 (JST)
Subject: [ruby-changes:71940] 08cee2bf80 (master): altstack is native thread's attr

https://git.ruby-lang.org/ruby.git/commit/?id=08cee2bf80

From 08cee2bf804d22dc51002b0df023aea7ec044d8d Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Tue, 24 May 2022 16:39:45 +0900
Subject: altstack is native thread's attr

Move th->altstack to th->nt->altstack.
---
 thread_pthread.c |  4 ++--
 thread_pthread.h |  4 ++++
 vm_core.h        | 10 +++-------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/thread_pthread.c b/thread_pthread.c
index 451f47e07f..5c181556b9 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1052,7 +1052,7 @@ static void * https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1052
 thread_start_func_1(void *th_ptr)
 {
     rb_thread_t *th = th_ptr;
-    RB_ALTSTACK_INIT(void *altstack, th->altstack);
+    RB_ALTSTACK_INIT(void *altstack, th->nt->altstack);
 #if USE_THREAD_CACHE
   thread_start:
 #endif
@@ -1208,7 +1208,7 @@ native_thread_create(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1208
 	const size_t space = space_size(stack_size);
 
 #ifdef USE_SIGALTSTACK
-        th->altstack = rb_allocate_sigaltstack();
+        th->nt->altstack = rb_allocate_sigaltstack();
 #endif
         th->ec->machine.stack_maxsize = stack_size - space;
 
diff --git a/thread_pthread.h b/thread_pthread.h
index 8e8c1eb43d..ebca71b5cd 100644
--- a/thread_pthread.h
+++ b/thread_pthread.h
@@ -50,6 +50,10 @@ struct rb_native_thread { https://github.com/ruby/ruby/blob/trunk/thread_pthread.h#L50
         rb_nativethread_cond_t intr; /* th->interrupt_lock */
         rb_nativethread_cond_t readyq; /* use sched->lock */
     } cond;
+
+#ifdef USE_SIGALTSTACK
+    void *altstack;
+#endif
 };
 
 #undef except
diff --git a/vm_core.h b/vm_core.h
index 58fb1e7e3b..2fca0aecd2 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -101,9 +101,6 @@ extern int ruby_assert_critical_section_entered; https://github.com/ruby/ruby/blob/trunk/vm_core.h#L101
 #include "vm_opts.h"
 
 #include "ruby/thread_native.h"
-#include THREAD_IMPL_H
-
-#define RUBY_VM_THREAD_MODEL 2
 
 /*
  * implementation selector of get_insn_info algorithm
@@ -162,6 +159,9 @@ void *rb_register_sigaltstack(void *); https://github.com/ruby/ruby/blob/trunk/vm_core.h#L159
 #  define RB_ALTSTACK(var) (0)
 #endif
 
+#include THREAD_IMPL_H
+#define RUBY_VM_THREAD_MODEL 2
+
 /*****************/
 /* configuration */
 /*****************/
@@ -1072,10 +1072,6 @@ typedef struct rb_thread_struct { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1072
     VALUE name;
 
     struct rb_ext_config ext_config;
-
-#ifdef USE_SIGALTSTACK
-    void *altstack;
-#endif
 } rb_thread_t;
 
 static inline unsigned int
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]