[前][次][番号順一覧][スレッド一覧][生データ]

yarv-dev:916

From: 雪見酒 <yukimi_sake mbi.nifty.com>
Date: Fri, 17 Feb 2006 22:13:12 +0900
Subject: [yarv-dev:916] open> SizedQueue#push don't work on yarv-r436

すみません、openし忘れました

ということで、こんなのでいかがでしょ?

D:\yarv\lib\ruby\1.9>diff -u thread.rb.org thread.rb
--- thread.rb.org       2006-02-15 22:12:34.000000000 +0900
+++ thread.rb   2006-02-17 21:34:44.859375000 +0900
@@ -292,13 +292,23 @@
   def push(obj)
     while true
       @mutex.lock
-      break if @que.length >= @max
+      break if @que.length <= @max
       @queue_wait.push Thread.current
-      @mutex.unlock_and_sleep
+      @mutex.unlock_and_stop
+    end
+    @que.push obj
+    begin
+      t = @waiting.shift
+      t.wakeup if t
+    rescue ThreadError
+      retry
     end
-    super
   ensure
     @mutex.unlock
+    begin
+      t.run if t
+    rescue ThreadError
+    end
   end

   #

-- 
ML: yarv-dev quickml.atdot.net
使い方: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]

       915 2006-02-17 22:06 [yukimi_sake mbi.nift] SizedQueue#push don't work on yarv-r436 
->     916 2006-02-17 22:13 ┣[yukimi_sake mbi.nift] open> SizedQueue#push don't work on yarv-r436
       917 2006-02-17 22:23 ┃┗[yukimi_sake mbi.nift]                                     
       921 2006-02-17 23:54 ┗[ko1 atdot.net       ]                                       
       927 2006-02-18 10:06  ┗[yukimi_sake mbi.nift]                                     
       928 2006-02-19 01:20   ┗[aamine loveruby.net ] fixed> Re: SizedQueue#push don't work on yarv-r436