$39 GRAYBYTE WORDPRESS FILE MANAGER $85

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.23
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/ruby21/lib64/ruby/2.1.0/

HOME
Current File : /opt/alt/ruby21/lib64/ruby/2.1.0//thwait.rb
#
#   thwait.rb - thread synchronization class
#       $Release Version: 0.9 $
#       $Revision: 1.3 $
#       by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd.)

require "thread.rb"
require "e2mmap.rb"

#
# This class watches for termination of multiple threads.  Basic functionality
# (wait until specified threads have terminated) can be accessed through the
# class method ThreadsWait::all_waits.  Finer control can be gained using
# instance methods.
#
# Example:
#
#   ThreadsWait.all_waits(thr1, thr2, ...) do |t|
#     STDERR.puts "Thread #{t} has terminated."
#   end
#
#
#   th = ThreadsWait.new(thread1,...)
#   th.next_wait # next one to be done
#
#
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 as they terminate.
  #
  def ThreadsWait.all_waits(*threads) # :yield: thread
    tw = ThreadsWait.new(*threads)
    if block_given?
      tw.all_waits do |th|
        yield th
      end
    else
      tw.all_waits
    end
  end

  #
  # Creates a ThreadsWait object, specifying the threads to wait on.
  # Non-blocking.
  #
  def initialize(*threads)
    @threads = []
    @wait_queue = Queue.new
    join_nowait(*threads) unless threads.empty?
  end

  # Returns the array of threads that have not terminated yet.
  attr :threads

  #
  # Returns +true+ if there are no threads in the pool still running.
  #
  def empty?
    @threads.empty?
  end

  #
  # Returns +true+ if any thread has terminated and is ready to be collected.
  #
  def finished?
    !@wait_queue.empty?
  end

  #
  # Waits for specified threads to terminate, and returns when one of
  # the threads terminated.
  #
  def join(*threads)
    join_nowait(*threads)
    next_wait
  end

  #
  # Specifies the threads that this object will wait for, but does not actually
  # wait.
  #
  def join_nowait(*threads)
    threads.flatten!
    @threads.concat threads
    for th in threads
      Thread.start(th) do |t|
        begin
          t.join
        ensure
          @wait_queue.push t
        end
      end
    end
  end

  #
  # Waits until any of the specified threads has terminated, and returns the one
  # that does.
  #
  # If there is no thread to wait, raises +ErrNoWaitingThread+.  If +nonblock+
  # is true, and there is no terminated thread, raises +ErrNoFinishedThread+.
  #
  def next_wait(nonblock = nil)
    ThreadsWait.fail ErrNoWaitingThread if @threads.empty?
    begin
      @threads.delete(th = @wait_queue.pop(nonblock))
      th
    rescue ThreadError
      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.
  #
  # Raises exceptions in the same manner as +next_wait+.
  #
  def all_waits
    until @threads.empty?
      th = next_wait
      yield th if block_given?
    end
  end
end

##
# An alias for ThreadsWait from thwait.rb

ThWait = ThreadsWait

# Documentation comments:
#  - Source of documentation is evenly split between Nutshell, existing
#    comments, and my own rephrasing.
#  - I'm not particularly confident that the comments are all exactly correct.


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.43 PM
root / root
0755
cgi
--
3 Mar 2024 10.43 PM
root / linksafe
0755
date
--
3 Mar 2024 10.43 PM
root / linksafe
0755
digest
--
3 Mar 2024 10.43 PM
root / linksafe
0755
dl
--
3 Mar 2024 10.43 PM
root / linksafe
0755
drb
--
3 Mar 2024 10.43 PM
root / linksafe
0755
fiddle
--
3 Mar 2024 10.43 PM
root / linksafe
0755
io
--
3 Mar 2024 10.43 PM
root / linksafe
0755
irb
--
3 Mar 2024 10.43 PM
root / linksafe
0755
json
--
3 Mar 2024 10.43 PM
root / linksafe
0755
matrix
--
3 Mar 2024 10.43 PM
root / linksafe
0755
net
--
3 Mar 2024 10.43 PM
root / linksafe
0755
openssl
--
3 Mar 2024 10.43 PM
root / linksafe
0755
optparse
--
3 Mar 2024 10.43 PM
root / linksafe
0755
psych
--
3 Mar 2024 10.43 PM
root / linksafe
0755
racc
--
3 Mar 2024 10.43 PM
root / linksafe
0755
rake
--
3 Mar 2024 10.53 PM
root / linksafe
0755
rbconfig
--
3 Mar 2024 10.43 PM
root / linksafe
0755
rdoc
--
3 Mar 2024 10.43 PM
root / linksafe
0755
rexml
--
3 Mar 2024 10.43 PM
root / linksafe
0755
rinda
--
3 Mar 2024 10.43 PM
root / linksafe
0755
ripper
--
3 Mar 2024 10.43 PM
root / linksafe
0755
rss
--
3 Mar 2024 10.43 PM
root / linksafe
0755
rubygems
--
3 Mar 2024 10.43 PM
root / linksafe
0755
shell
--
3 Mar 2024 10.43 PM
root / linksafe
0755
syslog
--
3 Mar 2024 10.43 PM
root / root
0755
test
--
3 Mar 2024 10.43 PM
root / linksafe
0755
uri
--
3 Mar 2024 10.43 PM
root / linksafe
0755
webrick
--
3 Mar 2024 10.43 PM
root / linksafe
0755
x86_64-linux
--
3 Mar 2024 10.43 PM
root / root
0755
xmlrpc
--
3 Mar 2024 10.43 PM
root / linksafe
0755
yaml
--
3 Mar 2024 10.43 PM
root / linksafe
0755
English.rb
6.443 KB
4 Feb 2013 2.50 AM
root / linksafe
0644
abbrev.rb
3.313 KB
21 Feb 2013 5.35 PM
root / linksafe
0644
base64.rb
2.631 KB
19 May 2013 3.10 AM
root / linksafe
0644
benchmark.rb
17.952 KB
20 Sep 2013 4.05 PM
root / linksafe
0644
cgi.rb
9.841 KB
18 Jul 2013 1.50 PM
root / linksafe
0644
cmath.rb
8.927 KB
3 Jul 2015 9.12 AM
root / linksafe
0644
complex.rb
0.371 KB
16 Aug 2009 3.34 PM
root / linksafe
0644
csv.rb
81.682 KB
14 Sep 2014 3.25 PM
root / linksafe
0644
date.rb
0.924 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
debug.rb
29.077 KB
14 Dec 2013 2.48 PM
root / linksafe
0644
delegate.rb
11.125 KB
2 Feb 2014 1.46 PM
root / linksafe
0644
digest.rb
2.338 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
dl.rb
0.273 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
drb.rb
0.019 KB
2 Oct 2009 10.45 AM
root / linksafe
0644
e2mmap.rb
3.891 KB
17 Dec 2013 11.20 AM
root / linksafe
0644
erb.rb
26.073 KB
11 Aug 2014 2.55 PM
root / linksafe
0644
expect.rb
2.144 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
fiddle.rb
1.652 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
fileutils.rb
47.171 KB
28 Apr 2015 5.16 AM
root / linksafe
0644
find.rb
2.359 KB
15 Oct 2014 3.31 PM
root / linksafe
0644
forwardable.rb
7.863 KB
23 May 2013 9.46 PM
root / linksafe
0644
getoptlong.rb
15.381 KB
19 May 2013 2.50 PM
root / linksafe
0644
gserver.rb
8.856 KB
6 Jul 2014 1.57 PM
root / linksafe
0644
ipaddr.rb
17.051 KB
29 Oct 2015 2.36 PM
root / linksafe
0644
irb.rb
20.034 KB
25 Mar 2016 8.22 AM
root / linksafe
0644
json.rb
1.737 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
kconv.rb
5.737 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
logger.rb
22.371 KB
25 Feb 2016 11.04 AM
root / linksafe
0644
mathn.rb
6.524 KB
26 Aug 2011 10.22 PM
root / linksafe
0644
matrix.rb
45.432 KB
11 Jul 2014 2.08 PM
root / linksafe
0644
mkmf.rb
80.503 KB
26 Jul 2023 2.19 PM
root / linksafe
0644
monitor.rb
6.935 KB
16 Nov 2012 4.55 PM
root / linksafe
0644
mutex_m.rb
2.002 KB
20 Feb 2013 2.51 AM
root / linksafe
0644
observer.rb
5.807 KB
21 Nov 2013 4.44 AM
root / linksafe
0644
open-uri.rb
24.268 KB
22 Feb 2014 8.54 AM
root / linksafe
0644
open3.rb
20.366 KB
1 Dec 2013 3.13 AM
root / linksafe
0644
openssl.rb
0.516 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
optparse.rb
50.796 KB
28 Nov 2013 7.34 AM
root / linksafe
0644
ostruct.rb
7.702 KB
23 Oct 2013 3.14 PM
root / linksafe
0644
pathname.rb
15.297 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
pp.rb
14.097 KB
22 Oct 2013 9.29 AM
root / linksafe
0644
prettyprint.rb
16.331 KB
19 May 2013 3.10 AM
root / linksafe
0644
prime.rb
13.203 KB
15 Jul 2013 4.21 AM
root / linksafe
0644
profile.rb
0.2 KB
2 Oct 2009 10.45 AM
root / linksafe
0644
profiler.rb
4.509 KB
19 May 2013 11.04 PM
root / linksafe
0644
pstore.rb
14.849 KB
11 Nov 2012 4.23 AM
root / linksafe
0644
psych.rb
14.878 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
rake.rb
2.116 KB
11 Oct 2013 9.35 PM
root / linksafe
0644
rational.rb
0.301 KB
24 Sep 2009 12.42 AM
root / linksafe
0644
rdoc.rb
4.921 KB
22 Dec 2013 10.25 AM
root / linksafe
0644
resolv-replace.rb
1.732 KB
11 Mar 2013 1.47 PM
root / linksafe
0644
resolv.rb
72.308 KB
13 May 2015 5.33 AM
root / linksafe
0644
ripper.rb
2.525 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
rss.rb
2.841 KB
11 May 2011 10.22 AM
root / linksafe
0644
rubygems.rb
30.974 KB
26 Jul 2023 2.19 PM
root / linksafe
0644
scanf.rb
23.542 KB
14 Dec 2013 2.55 AM
root / linksafe
0644
securerandom.rb
8.49 KB
7 Nov 2013 6.04 PM
root / linksafe
0644
set.rb
18.704 KB
22 Nov 2013 11.50 PM
root / linksafe
0644
shell.rb
10.299 KB
19 May 2013 3.10 AM
root / linksafe
0644
shellwords.rb
5.941 KB
14 Dec 2013 6.26 PM
root / linksafe
0644
singleton.rb
4.018 KB
18 May 2011 2.09 PM
root / linksafe
0644
socket.rb
25.596 KB
26 Jul 2023 2.22 PM
root / linksafe
0644
sync.rb
7.255 KB
19 May 2013 3.10 AM
root / linksafe
0644
tempfile.rb
11.398 KB
21 Nov 2013 9.28 AM
root / linksafe
0644
thwait.rb
3.377 KB
7 Nov 2013 5.02 PM
root / linksafe
0644
time.rb
21.316 KB
17 Aug 2015 7.41 AM
root / linksafe
0644
timeout.rb
3.697 KB
17 Aug 2015 7.55 AM
root / linksafe
0644
tmpdir.rb
4.149 KB
19 May 2013 3.10 AM
root / linksafe
0644
tracer.rb
6.402 KB
18 Jul 2013 1.50 PM
root / linksafe
0644
tsort.rb
14.145 KB
17 Oct 2013 3.59 PM
root / linksafe
0644
ubygems.rb
0.262 KB
2 Oct 2009 10.45 AM
root / linksafe
0644
un.rb
8.873 KB
5 Jul 2013 1.43 PM
root / linksafe
0644
uri.rb
3.07 KB
13 May 2011 8.03 PM
root / linksafe
0644
weakref.rb
3.229 KB
9 Nov 2013 10.42 PM
root / linksafe
0644
webrick.rb
6.689 KB
5 Oct 2013 11.39 PM
root / linksafe
0644
xmlrpc.rb
8.488 KB
12 Dec 2013 3.09 AM
root / linksafe
0644
yaml.rb
2.313 KB
12 Aug 2013 3.49 AM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF