[#11131] Re: SIGINT on windows — Daisuke Aoki <dai@...>

青木です。

36 messages 2000/10/04
[#11217] Re: SIGINT on windows — Daisuke Aoki <dai@...> 2000/10/14

青木です。

[#11250] Re: SIGINT on windows — Daisuke Aoki <dai@...> 2000/10/16

青木です。

[#11258] Re: SIGINT on windows — "Nobuyoshi.Nakada" <nobu.nakada@...> 2000/10/17

なかだです。

[#11298] Re: SIGINT on windows — "Nobuyoshi.Nakada" <nobu.nakada@...> 2000/10/27

なかだです。

[#11183] EPOC32 and Ruby 1.7 — WATANABE Hirofumi <eban@...>

わたなべです.

44 messages 2000/10/12
[#11188] Re: EPOC32 and Ruby 1.7 — matz@... (Yukihiro Matsumoto) 2000/10/12

まつもと ゆきひろです

[#11191] ruby-bugs-ja PR#20 — Kazuhiro NISHIYAMA <zn@...> 2000/10/12

On Fri, 13 Oct 2000 00:17:14 +0900

[#11205] Re: ruby-bugs-ja PR#20 — Kazuhiro NISHIYAMA <zn@...> 2000/10/13

同じ問題を短いスクリプトで再現できました。

[#11210] Re: Thread.new with irb (PR#20) — matz@... (Yukihiro Matsumoto) 2000/10/13

まつもと ゆきひろです

[#11211] Re: Thread.new with irb (PR#20) — Kazuhiro NISHIYAMA <zn@...> 2000/10/13

On Sat, 14 Oct 2000 03:41:18 +0900

[#11221] Re: Thread.new with irb (PR#20) — Kazuhiro NISHIYAMA <zn@...> 2000/10/14

[ruby-dev:11205]と同じスクリプトで-dをつけていると

[#11306] Ruby I18N — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

130 messages 2000/10/28
[#11307] Re: Ruby I18N — " たけ (tk)" <ggb03124@...> 2000/10/28

たけ(tk)です。

[#11310] Re: Ruby I18N — kenn@... 2000/10/29

長沢です。

[#11314] Re: Ruby I18N — matz@... (Yukihiro Matsumoto) 2000/10/29

まつもと ゆきひろです

[#11315] Re: Ruby I18N — Shugo Maeda <shugo@...> 2000/10/30

前田です。

[#11324] Re: Ruby I18N — TAKAHASHI Masayoshi <maki@...> 2000/10/30

高橋征義です。

[#11337] Re: Ruby I18N — Yasushi Shoji <yashi@...> 2000/10/30

At Mon, 30 Oct 2000 13:15:23 +0900,

[#11346] Re: Ruby I18N — TAKAHASHI Masayoshi <maki@...> 2000/10/31

某2ちゃんねるで自分の名前を見つけてびびった高橋征義です。

[#11347] Re: Ruby I18N — matz@... (Yukihiro Matsumoto) 2000/10/31

まつもと ゆきひろです

[#11370] Re: Ruby I18N — TAKAHASHI Masayoshi <maki@...> 2000/11/02

高橋征義です。

[#11372] Re: Ruby I18N — matz@... (Yukihiro Matsumoto) 2000/11/02

まつもと ゆきひろです

[#11375] Re: Ruby I18N — TAKAHASHI Masayoshi <maki@...> 2000/11/04

高橋征義です。

[#11378] Re: Ruby I18N — " たけ (tk)" <ggb03124@...> 2000/11/05

たけ(tk)です。

[#11379] Re: Ruby I18N — matz@... (Yukihiro Matsumoto) 2000/11/05

まつもと ゆきひろです

[#11380] Re: Ruby I18N — " たけ (tk)" <ggb03124@...> 2000/11/05

たけ(tk)です。

[#11382] Re: Ruby I18N — matz@... (Yukihiro Matsumoto) 2000/11/05

まつもと ゆきひろです

[#11393] Re: Ruby I18N — "たけ(tk)" <ggb03124@...> 2000/11/07

たけ(tk)です。 ・・ 長文ご注意。

[#11396] Re: Ruby I18N — matz@... (Yukihiro Matsumoto) 2000/11/07

まつもと ゆきひろです

[#11397] Re: Ruby I18N — Yasushi Shoji <yashi@...> 2000/11/07

At Tue, 7 Nov 2000 15:46:29 +0900,

[#11398] Re: Ruby I18N — matz@... (Yukihiro Matsumoto) 2000/11/07

まつもと ゆきひろです

[#11399] Re: Ruby I18N — Tanaka Akira <akr@...17n.org> 2000/11/07

In article <E13t3dt-0002Fp-00@ev.netlab.zetabits.co.jp>,

[#11401] Re: Ruby I18N — matz@... (Yukihiro Matsumoto) 2000/11/07

まつもと ゆきひろです

[#11404] Re: Ruby I18N — "たけ(tk)" <ggb03124@...> 2000/11/07

たけ(tk)です。

[#11406] Re: Ruby I18N — Yasushi Shoji <yashi@...> 2000/11/07

At Tue, 7 Nov 2000 19:06:27 +0900,

[#11407] Re: Ruby I18N — "たけ(tk)" <ggb03124@...> 2000/11/07

たけ(tk)です。

[#11409] Re: Ruby I18N — Minero Aoki <aamine@...> 2000/11/07

あおきです。

[#11423] Re: Ruby I18N — Tanaka Akira <akr@...17n.org> 2000/11/08

In article <E13t4Hq-0002GS-00@ev.netlab.zetabits.co.jp>,

[#11426] Re: Ruby I18N — matz@... (Yukihiro Matsumoto) 2000/11/08

まつもと ゆきひろです

[#11427] Re: Ruby I18N — Tanaka Akira <akr@...17n.org> 2000/11/08

In article <E13tMYW-0002te-00@ev.netlab.zetabits.co.jp>,

[#11428] Re: Ruby I18N — matz@... (Yukihiro Matsumoto) 2000/11/08

まつもと ゆきひろです

[#11430] Re: Ruby I18N — "たけ(tk)" <ggb03124@...> 2000/11/08

たけ(tk)です。

[#11433] Re: Ruby I18N — matz@... (Yukihiro Matsumoto) 2000/11/08

まつもと ゆきひろです

[#11446] 『文字列は文字の配列か』 — " たけ (tk)" <ggb03124@...> 2000/11/08

たけ(tk)です。

[#11470] Proposal of "Array of CharCode" — " たけ (tk)" <ggb03124@...> 2000/11/10

たけ(tk)です。

[#11471] Re: Proposal of "Array of CharCode" — matz@... (Yukihiro Matsumoto) 2000/11/10

まつもと ゆきひろです

[#11450] Re: Ruby I18N — Tanaka Akira <akr@...17n.org> 2000/11/09

In article <E13tNkT-00030l-00@ev.netlab.zetabits.co.jp>,

[ruby-dev:11210] Re: Thread.new with irb (PR#20)

From: matz@... (Yukihiro Matsumoto)
Date: 2000-10-13 18:41:18 UTC
List: ruby-dev #11210
まつもと ゆきひろです

In message "Re: Thread.new with irb (PR#20)"
    on 00/10/14, komatsu@sarion.co.jp <komatsu@sarion.co.jp> writes:

|In the message of "Thread.new with irb"
|    on 2000/10/11 22:41 Katsuyuki Komatsu <komatsu@sarion.co.jp> wrote:
|> irbで"p Thread.new"を実行するとSegmentation faultになりました.

|なお,
|    [ruby-dev:11205] Re: ruby-bugs-ja PR#20
|で西山さんが,同じ問題を短いスクリプトで再現されました.
|記録のためruby-bugs-jaにも送ります.

というわけで、このスクリプトのおかげで問題が発見できました。
要するにエラーが発生した Thread.start で作られた中途半端なス
レッドがタイミングによって消滅する前に実行権を奪い取ってしま
う(し、初期化されてないのであちこち壊してまわる)のが原因でし
た。スレッドのバグは再現性が低くて困りますね。

パッチです。

--- eval.c	2000/10/13 09:01:53	1.119
+++ eval.c	2000/10/13 18:39:51
@@ -666,3 +666,2 @@
     while (vars) {
-	if (TYPE(vars) != T_VARMAP) abort();
 	if (curr && vars->id == 0) {
@@ -731,2 +730,3 @@
     struct tag *prev;
+    int line;
 };
@@ -744,2 +744,3 @@
     _tag.dst = 0;			\
+    _tag.line = __LINE__;		\
     prot_tag = &_tag;
@@ -800,2 +801,3 @@
 static rb_thread_t curr_thread = 0;
+static rb_thread_t main_thread;
 static void scope_dup _((struct SCOPE *));
@@ -870,4 +872,4 @@
 {
-    VALUE errat = Qnil;
-    VALUE eclass;
+    VALUE errat = Qnil;		/* OK */
+    volatile VALUE eclass;
     char *einfo;
@@ -4839,3 +4841,3 @@
 	if (state) JUMP_TAG(state);
-	
+
 	return result;
@@ -4932,3 +4934,3 @@
     volatile VALUE wrapper = 0;
-    VALUE self = ruby_top_self;
+    volatile VALUE self = ruby_top_self;
     TMP_PROTECT;
@@ -6148,3 +6150,3 @@
 {
-    VALUE block = rb_eval(self, node->nd_body);
+    VALUE block = rb_eval(self, node->nd_body);	/* OK */
     struct BLOCK * volatile old_block;
@@ -6625,5 +6627,2 @@
 
-static rb_thread_t main_thread;
-/*static rb_thread_t curr_thread = 0;*/
-
 #define FOREACH_THREAD_FROM(f,x) x = f; do { x = x->next;
@@ -6756,3 +6755,2 @@
     VALUE *pos;
-
     int len;
@@ -7007,3 +7005,2 @@
 {
-    struct stat s;
     int i, test = Qfalse;
@@ -7302,3 +7299,2 @@
     double limit;
-    struct timeval zero;
     int n;
@@ -7645,2 +7641,5 @@
 \
+    th->next = 0;\
+    th->prev = 0;\
+\
     th->status = THREAD_RUNNABLE;\
@@ -7675,3 +7674,2 @@
     th->gid = 1;\
-    th->locals = 0;\
 } while(0)
@@ -7688,15 +7686,2 @@
 
-    if (curr_thread) {
-	th->prev = curr_thread;
-	curr_thread->next->prev = th;
-	th->next = curr_thread->next;
-	curr_thread->next = th;
-	th->priority = curr_thread->priority;
-	th->gid = curr_thread->gid;
-    }
-    else {
-	curr_thread = th->prev = th->next = th;
-	th->status = THREAD_RUNNABLE;
-    }
-
     for (vars = th->dyna_vars; vars; vars = vars->next) {
@@ -7708,2 +7693,14 @@
 
+static void
+rb_thread_add_ring(th)
+    rb_thread_t th;
+{
+    th->prev = curr_thread;
+    curr_thread->next->prev = th;
+    th->next = curr_thread->next;
+    curr_thread->next = th;
+    th->priority = curr_thread->priority;
+    th->gid = curr_thread->gid;
+}
+
 #if defined(HAVE_SETITIMER)
@@ -7760,7 +7757,8 @@
 static VALUE
-rb_thread_start_0(fn, arg, th)
+rb_thread_start_0(fn, arg, th_arg)
     VALUE (*fn)();
     void *arg;
-    rb_thread_t th;
+    rb_thread_t th_arg;
 {
+    volatile rb_thread_t th = th_arg;
     volatile VALUE thread = th->thread;
@@ -7793,6 +7791,11 @@
     if ((state = EXEC_TAG()) == 0) {
-	if (THREAD_SAVE_CONTEXT(th) == 0) {
+#if 0
+	if ((status = THREAD_SAVE_CONTEXT(th)) == 0) {
+#endif
 	    curr_thread = th;
 	    th->result = (*fn)(arg, th);
+	    rb_thread_remove(th);
+#if 0
 	}
+#endif
     }
@@ -7800,3 +7803,2 @@
     status = th->status;
-    rb_thread_remove(th);
     if (state && status != THREAD_TO_KILL && !NIL_P(ruby_errinfo)) {
@@ -7835,3 +7837,5 @@
 {
-    return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
+    rb_thread_t th = rb_thread_alloc(rb_cThread);
+    rb_thread_add_ring(th);
+    return rb_thread_start_0(fn, arg, th);
 }
@@ -7866,3 +7870,3 @@
     if (th->stk_pos == pos) {
-	rb_raise(rb_eThreadError, "uninitialized thread - check `initialize' of %s",
+	rb_raise(rb_eThreadError, "uninitialized thread - check `%s#initialize'",
 		 rb_class2name(klass));
@@ -7877,2 +7881,4 @@
 {
+    rb_thread_t th;
+
     if (!rb_block_given_p()) {
@@ -7880,3 +7886,5 @@
     }
-    return rb_thread_start_0(rb_thread_yield, args, rb_thread_check(thread));
+    th = rb_thread_check(thread);
+    rb_thread_add_ring(th);
+    return rb_thread_start_0(rb_thread_yield, args, th);
 }
@@ -7887,2 +7895,4 @@
 {
+    rb_thread_t th;
+
     if (!rb_block_given_p()) {
@@ -7890,3 +7900,5 @@
     }
-    return rb_thread_start_0(rb_thread_yield, args, rb_thread_alloc(klass));
+    th = rb_thread_alloc(rb_cThread);
+    rb_thread_add_ring(th);
+    return rb_thread_start_0(rb_thread_yield, args, th);
 }
@@ -8094,2 +8106,3 @@
     rb_thread_raise(argc, argv, th);
+    return Qnil;		/* not reached */
 }
@@ -8172,3 +8185,3 @@
     rb_thread_t th = rb_thread_check(thread);
-    char *s, *status;
+    char *status;
     VALUE str;
@@ -8207,4 +8220,4 @@
     THREAD_ALLOC(th);
-    cont = Data_Wrap_Struct(rb_cCont, thread_mark,
-					 thread_free, th);
+    th->status = THREAD_RUNNABLE;
+    cont = Data_Wrap_Struct(rb_cCont, thread_mark, thread_free, th);
 
@@ -8367,2 +8380,3 @@
     main_thread = rb_thread_alloc(rb_cThread);
+    curr_thread = main_thread->prev = main_thread->next = main_thread;
 
@@ -8480,2 +8494 @@
 }
-



In This Thread