summaryrefslogtreecommitdiffstats
path: root/lib/thwait.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
commitd17d1b111341f2c8979cf8fbd63ec7ec9db7c3ad (patch)
tree5e35d5b41aae961b37cf6632f60c42f51c7aa775 /lib/thwait.rb
parent101e79d7b434c01c0e6f4bcc480003858ab8e1a4 (diff)
downloadruby-d17d1b111341f2c8979cf8fbd63ec7ec9db7c3ad.tar.gz
ruby-d17d1b111341f2c8979cf8fbd63ec7ec9db7c3ad.tar.xz
ruby-d17d1b111341f2c8979cf8fbd63ec7ec9db7c3ad.zip
* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/thwait.rb')
-rw-r--r--lib/thwait.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/thwait.rb b/lib/thwait.rb
index 029b25915..09d99a6c5 100644
--- a/lib/thwait.rb
+++ b/lib/thwait.rb
@@ -15,7 +15,7 @@
# each thread termination.
# * th = ThreadsWait.new(thread1,...)
# creates synchronization object, specifying thread(s) to wait.
-#
+#
# methods:
# * th.threads
# list threads to be synchronized
@@ -23,7 +23,7 @@
# is there any thread to be synchronized.
# * th.finished?
# is there already terminated thread.
-# * th.join(thread1,...)
+# * th.join(thread1,...)
# wait for specified thread(s).
# * th.join_nowait(threa1,...)
# specifies thread(s) to wait. non-blocking.
@@ -52,11 +52,11 @@ require "e2mmap.rb"
#
class ThreadsWait
RCS_ID='-$Id: thwait.rb,v 1.3 1998/06/26 03:19:34 keiju Exp keiju $-'
-
+
extend Exception2MessageMapper
def_exception("ErrNoWaitingThread", "No threads for waiting.")
def_exception("ErrNoFinishedThread", "No finished threads.")
-
+
#
# Waits until all specified threads have terminated. If a block is provided,
# it is executed for each thread termination.
@@ -71,7 +71,7 @@ class ThreadsWait
tw.all_waits
end
end
-
+
#
# Creates a ThreadsWait object, specifying the threads to wait on.
# Non-blocking.
@@ -81,24 +81,24 @@ class ThreadsWait
@wait_queue = Queue.new
join_nowait(*threads) unless threads.empty?
end
-
+
# Returns the array of threads in the wait queue.
attr :threads
-
+
#
# Returns +true+ if there are no threads to be synchronized.
#
def empty?
@threads.empty?
end
-
+
#
# Returns +true+ if any thread has terminated.
#
def finished?
!@wait_queue.empty?
end
-
+
#
# Waits for specified threads to terminate.
#
@@ -106,7 +106,7 @@ class ThreadsWait
join_nowait(*threads)
next_wait
end
-
+
#
# Specifies the threads that this object will wait for, but does not actually
# wait.
@@ -124,7 +124,7 @@ class ThreadsWait
end
end
end
-
+
#
# Waits until any of the specified threads has terminated, and returns the one
# that does.
@@ -141,7 +141,7 @@ class ThreadsWait
ThreadsWait.fail ErrNoFinishedThread
end
end
-
+
#
# Waits until all of the specified threads are terminated. If a block is
# supplied for the method, it is executed for each thread termination.