aboutsummaryrefslogtreecommitdiffstats
path: root/lib/thwait.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-25 09:15:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-25 09:15:08 +0000
commitb9228a014ba4818cdf584e3dda63ed1aed3ad1c7 (patch)
tree02b5b0ea6c42aa4186fe5095141f8782076fea8e /lib/thwait.rb
parent40412b77305befcaffd0f3fcf85d6cd8f2d75f3d (diff)
downloadruby-b9228a014ba4818cdf584e3dda63ed1aed3ad1c7.tar.gz
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/thwait.rb')
-rw-r--r--lib/thwait.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/thwait.rb b/lib/thwait.rb
index 3c17009310..00c8a8dd36 100644
--- a/lib/thwait.rb
+++ b/lib/thwait.rb
@@ -44,13 +44,12 @@ class ThreadsWait
Exception2MessageMapper.extend_to(binding)
def_exception("ErrNoWaitingThread", "No threads for waiting.")
- def_exception("ErrNoFinshedThread", "No finished threads.")
+ def_exception("ErrNoFinishedThread", "No finished threads.")
def ThreadsWait.all_waits(*threads)
tw = ThreadsWait.new(*threads)
if block_given?
- tw.all_waits do
- |th|
+ tw.all_waits do |th|
yield th
end
else
@@ -96,11 +95,12 @@ class ThreadsWait
# adds thread(s) to join, no wait.
def join_nowait(*threads)
- @threads.concat threads.flatten
+ threads.flatten!
+ @threads.concat threads
for th in threads
- Thread.start do
- th = th.join
- @wait_queue.push th
+ Thread.start(th) do |t|
+ t.join
+ @wait_queue.push t
end
end
end