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

ruby-changes:16664

From: nobu <ko1@a...>
Date: Sat, 17 Jul 2010 13:05:04 +0900 (JST)
Subject: [ruby-changes:16664] Ruby:r28660 (trunk): * thread.c (rb_thread_wakeup_alive): split from rb_thread_wakeup.

nobu	2010-07-17 13:04:51 +0900 (Sat, 17 Jul 2010)

  New Revision: 28660

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28660

  Log:
    * thread.c (rb_thread_wakeup_alive): split from rb_thread_wakeup.
      merged from r13476.  c.f. [ruby-core:31320]

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/intern.h
    trunk/thread.c

Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 28659)
+++ include/ruby/intern.h	(revision 28660)
@@ -333,6 +333,7 @@
 void rb_thread_sleep_forever(void);
 VALUE rb_thread_stop(void);
 VALUE rb_thread_wakeup(VALUE);
+VALUE rb_thread_wakeup_alive(VALUE);
 VALUE rb_thread_run(VALUE);
 VALUE rb_thread_kill(VALUE);
 VALUE rb_thread_create(VALUE (*)(ANYARGS), void*);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28659)
+++ ChangeLog	(revision 28660)
@@ -1,3 +1,8 @@
+Sat Jul 17 13:04:45 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* thread.c (rb_thread_wakeup_alive): split from rb_thread_wakeup.
+	  merged from r13476.  c.f. [ruby-core:31320]
+
 Sat Jul 17 10:07:52 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/test/unit.rb: MiniTest::Unit is different class from
Index: thread.c
===================================================================
--- thread.c	(revision 28659)
+++ thread.c	(revision 28660)
@@ -1547,11 +1547,20 @@
 VALUE
 rb_thread_wakeup(VALUE thread)
 {
+    if (!RTEST(rb_thread_wakeup_alive(thread))) {
+	rb_raise(rb_eThreadError, "killed thread");
+    }
+    return thread;
+}
+
+VALUE
+rb_thread_wakeup_alive(VALUE thread)
+{
     rb_thread_t *th;
     GetThreadPtr(thread, th);
 
     if (th->status == THREAD_KILLED) {
-	rb_raise(rb_eThreadError, "killed thread");
+	return Qnil;
     }
     rb_threadptr_ready(th);
     if (th->status != THREAD_TO_KILL) {

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

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