summaryrefslogtreecommitdiff
path: root/lib/thread.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-06 03:56:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-06 03:56:38 +0000
commit287a34ae0dfc23e4158f67cb7783d239f202c368 (patch)
tree5e35d5b41aae961b37cf6632f60c42f51c7aa775 /lib/thread.rb
parent9b52ae2e6491bb5d6c59e1799449f6268baf6f89 (diff)
* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/thread.rb')
-rw-r--r--lib/thread.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/thread.rb b/lib/thread.rb
index e5585c30bd6..cb6d8c62fcc 100644
--- a/lib/thread.rb
+++ b/lib/thread.rb
@@ -20,7 +20,7 @@ if $DEBUG
Thread.abort_on_exception = true
end
-#
+#
# ConditionVariable objects augment class Mutex. Using condition variables,
# it is possible to suspend while in the middle of a critical section until a
# resource becomes available.
@@ -31,7 +31,7 @@ end
#
# mutex = Mutex.new
# resource = ConditionVariable.new
-#
+#
# a = Thread.new {
# mutex.synchronize {
# # Thread 'a' now needs the resource
@@ -39,7 +39,7 @@ end
# # 'a' can now have the resource
# }
# }
-#
+#
# b = Thread.new {
# mutex.synchronize {
# # Thread 'b' has finished using the resource
@@ -55,7 +55,7 @@ class ConditionVariable
@waiters = []
@waiters_mutex = Mutex.new
end
-
+
#
# Releases the lock held in +mutex+ and waits; reacquires the lock on wakeup.
#
@@ -68,7 +68,7 @@ class ConditionVariable
mutex.sleep
end
end
-
+
#
# Wakes up the first thread in line waiting for this lock.
#
@@ -80,7 +80,7 @@ class ConditionVariable
retry
end
end
-
+
#
# Wakes up all threads waiting for this lock.
#
@@ -106,9 +106,9 @@ end
# Example:
#
# require 'thread'
-#
+#
# queue = Queue.new
-#
+#
# producer = Thread.new do
# 5.times do |i|
# sleep rand(i) # simulate expense
@@ -116,7 +116,7 @@ end
# puts "#{i} produced"
# end
# end
-#
+#
# consumer = Thread.new do
# 5.times do |i|
# value = queue.pop
@@ -124,7 +124,7 @@ end
# puts "consumed #{value}"
# end
# end
-#
+#
# consumer.join
#
class Queue
@@ -296,7 +296,7 @@ class SizedQueue < Queue
@queue_wait.push Thread.current
@mutex.sleep
end
-
+
@que.push obj
begin
t = @waiting.shift
@@ -305,7 +305,7 @@ class SizedQueue < Queue
retry
end
}
-
+
begin
t.run if t
rescue ThreadError