yarv-diff:316
From: ko1 atdot.net
Date: 27 Feb 2006 13:40:07 -0000
Subject: [yarv-diff:316] r481 - in trunk: . lib
Author: aamine
Date: 2006-02-27 22:40:07 +0900 (Mon, 27 Feb 2006)
New Revision: 481
Modified:
trunk/ChangeLog
trunk/lib/thread.rb
Log:
* lib/thread.rb: revert last commit.
* lib/thread.rb: non_block=true wrongly caused ThreadError.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-02-27 13:10:21 UTC (rev 480)
+++ trunk/ChangeLog 2006-02-27 13:40:07 UTC (rev 481)
@@ -4,6 +4,13 @@
# from Mon, 03 May 2004 01:24:19 +0900
#
+2006-02-27(Mon) 22:39:17 +0900 Minero Aoki <aamine loveruby.net>
+
+ * lib/thread.rb: last commit causes busy loop, revert it. [yarv-dev:990]
+
+ * lib/thread.rb: non_block=true wrongly caused ThreadError.
+
+
2006-02-27(Mon) 21:33:49 +0900 Koichi Sasada <ko1 atdot.net>
* common.mk : fix to display command line
Modified: trunk/lib/thread.rb
===================================================================
--- trunk/lib/thread.rb 2006-02-27 13:10:21 UTC (rev 480)
+++ trunk/lib/thread.rb 2006-02-27 13:40:07 UTC (rev 481)
@@ -176,19 +176,17 @@
# thread isn't suspended, and an exception is raised.
#
def pop(non_block=false)
- @mutex.synchronize{
- if @que.empty?
- raise ThreadError, "queue empty" if non_block
- @waiting.push Thread.current
- else
- return @que.shift
- end
- }
while true
@mutex.synchronize{
- return @que.shift unless @que.empty?
+ if @que.empty?
+ raise ThreadError, "queue empty" if non_block
+ @waiting.push Thread.current
+ @mutex.unlock_and_stop
+ @mutex.lock
+ else
+ return @que.shift
+ end
}
- Thread.pass
end
end
--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml