lib/lightio/library/threads_wait.rb in lightio-0.3.2 vs lib/lightio/library/threads_wait.rb in lightio-0.4.0.pre

- old
+ new

@@ -3,10 +3,15 @@ module LightIO::Library class ThreadsWait ErrNoWaitingThread = ::ThreadsWait::ErrNoWaitingThread ErrNoFinishedThread = ::ThreadsWait::ErrNoFinishedThread + extend Base::MockMethods + mock ::ThreadsWait + + extend LightIO::Module::ThreadsWait::ClassMethods + attr_reader :threads def initialize(*threads) @threads = threads end @@ -34,26 +39,20 @@ def join_nowait(*threads) @threads.concat(threads) end def next_wait(nonblock=nil) - raise ThreadsWait::ErrNoWaitingThread, 'No threads for waiting.' if empty? + raise ::ThreadsWait::ErrNoWaitingThread, 'No threads for waiting.' if empty? @threads.each do |thr| if thr.alive? && nonblock next elsif thr.alive? thr.join end # thr should dead @threads.delete(thr) return thr end - raise ThreadsWait::ErrNoFinishedThread, 'No finished threads.' - end - - class << self - def all_waits(*threads, &blk) - new(*threads).all_waits(&blk) - end + raise ::ThreadsWait::ErrNoFinishedThread, 'No finished threads.' end end end