[#46329] [ruby-trunk - Feature #7252][Assigned] version number of 2.0 release — "usa (Usaku NAKAMURA)" <usa@...>

26 messages 2012/11/01

[#46350] RubySpecメンテナ — Yukihiro Matsumoto <matz@...>

まつもと ゆきひろです

15 messages 2012/11/02
[#46352] Re: RubySpecメンテナ — Urabe Shyouhei <shyouhei@...> 2012/11/02

On 11/01/2012 07:43 PM, Yukihiro Matsumoto wrote:

[#46414] [ruby-trunk - Bug #7287][Open] please rename atomic.h which conflicts with /usr/include/atomic.h in Solaris10 — "ngoto (Naohisa Goto)" <ngotogenome@...>

10 messages 2012/11/06

[#46434] トラップハンドラで許されない操作はなにか — KOSAKI Motohiro <kosaki.motohiro@...>

GyRCPi46aiRHJDkbKEIKCltCdWcgIzcxMzRdIBskQiRyRDQkWSRGJCQkRj88SiUkSjtFTU1MZEJq

9 messages 2012/11/06

[#46440] [ruby-trunk - Bug #7300][Open] Hash#[] の挙動が 1.9.3 と異なっている — "hsbt (Hiroshi SHIBATA)" <shibata.hiroshi@...>

12 messages 2012/11/07

[#46477] Fwd: [ruby-changes:25559] shugo:r37616 (trunk): * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo): — SASADA Koichi <ko1@...>

refinement を導入するときの性能に対する excuse が「method cache に殆どあ

20 messages 2012/11/11
[#46480] Re: Fwd: [ruby-changes:25559] shugo:r37616 (trunk): * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo): — Shugo Maeda <shugo@...> 2012/11/11

前田です。

[#46488] Re: Fwd: [ruby-changes:25559] shugo:r37616 (trunk): * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo): — SASADA Koichi <ko1@...> 2012/11/12

 ささだです.

[#46491] Re: Fwd: [ruby-changes:25559] shugo:r37616 (trunk): * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo): — Shugo Maeda <shugo@...> 2012/11/12

前田です。

[#46493] Re: Fwd: [ruby-changes:25559] shugo:r37616 (trunk): * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo): — SASADA Koichi <ko1@...> 2012/11/12

 ささだです.

[#46495] Re: Fwd: [ruby-changes:25559] shugo:r37616 (trunk): * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo): — Shugo Maeda <shugo@...> 2012/11/12

前田です。

[#46497] Re: Fwd: [ruby-changes:25559] shugo:r37616 (trunk): * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo): — SASADA Koichi <ko1@...> 2012/11/12

(2012/11/12 18:20), Shugo Maeda wrote:

[#46501] Re: Fwd: [ruby-changes:25559] shugo:r37616 (trunk): * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo): — Shugo Maeda <shugo@...> 2012/11/12

前田です。

[#46513] Re: Fwd: [ruby-changes:25559] shugo:r37616 (trunk): * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo): — Nobuyoshi Nakada <nobu@...> 2012/11/14

なかだです。

[#46509] [ruby-trunk - Bug #7344][Open] gem pristine bigdecimal が失敗してしまう — "hsbt (Hiroshi SHIBATA)" <shibata.hiroshi@...>

31 messages 2012/11/13

[#46520] [ruby-trunk - Bug #7356][Open] ruby-2.0.0-preview1 で adlint-2.6.10 が性能劣化 — "yanoh (Yutaka Yanoh)" <yutaka@...>

11 messages 2012/11/15

[#46647] [ruby-trunk - Bug #7452][Assigned] Main thread is stopped after running finalizers if the main thread has a finalizer — "mrkn (Kenta Murata)" <muraken@...>

8 messages 2012/11/28

[ruby-dev:46641] Fwd: [ruby-changes:25810] kosaki:r37867 (trunk): * thread.c (rb_mutex_trylock, rb_mutex_unlock, mutex_sleep):

From: SASADA Koichi <ko1@...>
Date: 2012-11-27 06:50:00 UTC
List: ruby-dev #46641
Mutex#lock とかを,trap handler 中で出来ない,ってのは,すみません,どの
辺の話でしたっけ.

ruby-spec がこれで落ちているので気がつきました.
すみません,これってそういうものでしたっけ.
ちょっと,大きすぎるように思いまして.

main thread と trap handler 中で競合が発生する(デッドロックになる)のは
わかるんですが.

ちょっとした回避策ですが,

(1) main thread がロックを保持している
    時のみ,Mutex#lock が例外を発生させる

というのはどうでしょうか.これによって,

(a) trap 内で完結する lock はちゃんと動く
  (trap 内で unlock しない奴は死ねばいい)

(b) sub-thread で lock している奴は,trap 内で待つことができる

と出来ると思います.いかがでしょうか.


ちなみに,POSIX thread はどうなってるんでしたっけ.


-------- Original Message --------
Subject: [ruby-changes:25810] kosaki:r37867 (trunk): * thread.c
(rb_mutex_trylock, rb_mutex_unlock, mutex_sleep):
Date: Tue, 27 Nov 2012 00:17:13 +0900 (JST)
From: kosaki <ko1@atdot.net>
Reply-To: ruby-changes@quickml.atdot.net
To: ruby-changes@quickml.atdot.net

kosaki	2012-11-27 00:17:01 +0900 (Tue, 27 Nov 2012)

  New Revision: 37867

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

  Log:
    * thread.c (rb_mutex_trylock, rb_mutex_unlock, mutex_sleep):
      raises ThreadError if called from trap handler as Thread#join.
    * NEWS: news fot the above.

  Modified files:
    trunk/ChangeLog
    trunk/NEWS
    trunk/thread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37866)
+++ ChangeLog	(revision 37867)
@@ -1,3 +1,9 @@
+Tue Nov 27 00:13:41 2012  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
+	* thread.c (rb_mutex_trylock, rb_mutex_unlock, mutex_sleep):
+	  raises ThreadError if called from trap handler as Thread#join.
+	* NEWS: news fot the above.
+
 Mon Nov 26 23:55:33 2012  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>

 	* NEWS: update for Thread#join incompatible change.
Index: thread.c
===================================================================
--- thread.c	(revision 37866)
+++ thread.c	(revision 37867)
@@ -4051,6 +4051,11 @@
     VALUE locked = Qfalse;
     GetMutexPtr(self, mutex);

+    /* When running trap handler */
+    if (GET_THREAD()->interrupt_mask & TRAP_INTERRUPT_MASK) {
+	rb_raise(rb_eThreadError, "can't be called from trap context");
+    }
+
     native_mutex_lock(&mutex->lock);
     if (mutex->th == 0) {
 	mutex->th = GET_THREAD();
@@ -4239,6 +4244,11 @@
     rb_mutex_t *mutex;
     GetMutexPtr(self, mutex);

+    /* When running trap handler */
+    if (GET_THREAD()->interrupt_mask & TRAP_INTERRUPT_MASK) {
+	rb_raise(rb_eThreadError, "can't be called from trap context");
+    }
+
     err = rb_mutex_unlock_th(mutex, GET_THREAD());
     if (err) rb_raise(rb_eThreadError, "%s", err);

@@ -4307,6 +4317,11 @@
 {
     VALUE timeout;

+    /* When running trap handler */
+    if (GET_THREAD()->interrupt_mask & TRAP_INTERRUPT_MASK) {
+	rb_raise(rb_eThreadError, "can't be called from trap context");
+    }
+
     rb_scan_args(argc, argv, "01", &timeout);
     return rb_mutex_sleep(self, timeout);
 }
Index: NEWS
===================================================================
--- NEWS	(revision 37866)
+++ NEWS	(revision 37867)
@@ -105,6 +105,12 @@
       * Module#const_get accepts a qualified constant string, e.g.
         Object.const_get("Foo::Bar::Baz")

+  * Mutex
+    * incompatible changes:
+      * Mutex#lock, Mutex#unlock, Mutex#try_lock, Mutex#synchronize
+        and Mutex#sleep no longer allows to be used from trap handler.
+	Now it raises ThreadError.
+
   * NilClass
     * added method:
       * added nil.to_h which returns {}
@@ -350,3 +356,7 @@
   * Thread#join

     See above.
+
+  * Mutex#lock, Mutex#unlock, Mutex#try_lock, Mutex#synchronize and
Mutex#sleep
+
+    See above.

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


Attachments (1)

添付メッセージ部 (0 Bytes, text/plain)

  

In This Thread

Prev Next