summaryrefslogtreecommitdiff
path: root/lib/thwait.rb
diff options
context:
space:
mode:
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