[#20036] Re: Roundoff problem with Float and Marshal — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

16 messages 2003/04/18
[#20045] Re: Roundoff problem with Float and Marshal — nobu.nakada@... 2003/04/20

なかだです。

[#20063] Re: Roundoff problem with Float and Marshal — matz@... (Yukihiro Matsumoto) 2003/04/22

まつもと ゆきひろです

[#20097] jcode.rb — akira yamada / やまだあきら <akira@...>

25 messages 2003/04/26
[#20098] Re: jcode.rb — matz@... (Yukihiro Matsumoto) 2003/04/27

まつもと ゆきひろです

[#20105] Re: jcode.rb — WATANABE Hirofumi <eban@...> 2003/04/28

わたなべです。

[#20108] Re: jcode.rb — matz@... (Yukihiro Matsumoto) 2003/04/28

まつもと ゆきひろです

[ruby-dev:19957] Re: lib/tracer.rb and Thread.critical

From: Fukumoto Atsushi <fukumoto@...>
Date: 2003-04-03 17:31:15 UTC
List: ruby-dev #19957
lib/debug.rb の Thread.critical の件、下のようにしてみました。

個人的には、 lib/thread.rb の Thread.exclusive は組み込みにしたほうが
いいんじゃないかと思います。

それとは別の話ですが、 debug.rb のコマンドで trace on all したとき、 
Tracer が出力するスレッド番号と debug.rb の th コマンドで指定するスレッ
ドの番号が同じでないのはわかりにくいですね。あと、trace on all したあ
とに新しく生成されたスレッドも自動的にトレースしてほしいところです。そ
れから、デバッガーの thread switch コマンドを使うと、 Thread.stop して
止めてあるスレッドが起きてしまいます。 trace func でスレッド状態の変化
が伝わるようにすればデバッガー側で対応できるんじゃないでしょうか。



						福本 淳
						fukumoto@imasy.or.jp

Index: debug.rb
===================================================================
RCS file: /src/ruby/lib/debug.rb,v
retrieving revision 1.39
diff -u -r1.39 debug.rb
--- debug.rb	29 Mar 2003 06:39:50 -0000	1.39
+++ debug.rb	3 Apr 2003 16:12:04 -0000
@@ -30,6 +30,7 @@
   end
 
   def lock
+    return if Thread.critical
     return if @locker == Thread.current
     while (Thread.critical = true; @locked)
       @waiting.push Thread.current
@@ -42,6 +43,7 @@
   end
 
   def unlock
+    return if Thread.critical
     return unless @locked
     unless @locker == Thread.current
       raise RuntimeError, "unlocked by other"
@@ -115,6 +117,7 @@
   end
 
   def check_suspend
+    return if Thread.critical
     while (Thread.critical = true; @suspend_next)
       DEBUGGER__.waiting.push Thread.current
       @suspend_next = false
@@ -775,12 +778,13 @@
   end
 
   def set_trace( arg )
+    saved_crit = Thread.critical
     Thread.critical = true
     make_thread_list
     for th in @thread_list
       context(th[0]).set_trace arg
     end
-    Thread.critical = false
+    Thread.critical = saved_crit
     arg
   end
 
@@ -789,18 +793,20 @@
   end
 
   def suspend
+    saved_crit = Thread.critical
     Thread.critical = true
     make_thread_list
     for th in @thread_list
       next if th[0] == Thread.current
       context(th[0]).set_suspend
     end
-    Thread.critical = false
+    Thread.critical = saved_crit
     # Schedule other threads to suspend as soon as possible.
-    Thread.pass
+    Thread.pass unless Thread.critical
   end
 
   def resume
+    saved_crit = Thread.critical
     Thread.critical = true
     make_thread_list
     for th in @thread_list
@@ -811,7 +817,7 @@
       th.run
     end
     waiting.clear
-    Thread.critical = false
+    Thread.critical = saved_crit
     # Schedule other threads to restart as soon as possible.
     Thread.pass
   end

In This Thread

Prev Next