async 1.32.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/async/barrier.md +36 -0
 - data/lib/async/barrier.rb +14 -6
 - data/lib/async/clock.rb +11 -0
 - data/lib/async/condition.md +31 -0
 - data/lib/async/condition.rb +27 -16
 - data/lib/async/node.rb +27 -12
 - data/lib/async/notification.rb +4 -4
 - data/lib/async/queue.rb +8 -21
 - data/lib/async/reactor.rb +11 -320
 - data/lib/async/scheduler.rb +235 -48
 - data/lib/async/semaphore.md +41 -0
 - data/lib/async/semaphore.rb +8 -24
 - data/lib/async/task.rb +68 -114
 - data/lib/async/version.rb +1 -1
 - data/lib/async/wrapper.rb +19 -179
 - data/lib/async.rb +0 -5
 - data/lib/kernel/async.rb +26 -2
 - data/lib/kernel/sync.rb +14 -4
 - metadata +10 -10
 - data/lib/async/debug/monitor.rb +0 -47
 - data/lib/async/debug/selector.rb +0 -82
 - data/lib/async/logger.rb +0 -28
 
    
        data/lib/kernel/async.rb
    CHANGED
    
    | 
         @@ -24,7 +24,31 @@ require_relative "../async/reactor" 
     | 
|
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
            module Kernel
         
     | 
| 
       26 
26 
     | 
    
         
             
            	# Run the given block of code in a task, asynchronously, creating a reactor if necessary.
         
     | 
| 
       27 
     | 
    
         
            -
            	 
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 27 
     | 
    
         
            +
            	#
         
     | 
| 
      
 28 
     | 
    
         
            +
            	# The preferred method to invoke asynchronous behavior at the top level.
         
     | 
| 
      
 29 
     | 
    
         
            +
            	#
         
     | 
| 
      
 30 
     | 
    
         
            +
            	# - When invoked within an existing reactor task, it will run the given block
         
     | 
| 
      
 31 
     | 
    
         
            +
            	# asynchronously. Will return the task once it has been scheduled.
         
     | 
| 
      
 32 
     | 
    
         
            +
            	# - When invoked at the top level, will create and run a reactor, and invoke
         
     | 
| 
      
 33 
     | 
    
         
            +
            	# the block as an asynchronous task. Will block until the reactor finishes
         
     | 
| 
      
 34 
     | 
    
         
            +
            	# running.
         
     | 
| 
      
 35 
     | 
    
         
            +
            	#
         
     | 
| 
      
 36 
     | 
    
         
            +
            	# @yields {|task| ...} The block that will execute asynchronously.
         
     | 
| 
      
 37 
     | 
    
         
            +
            	# 	@parameter task [Async::Task] The task that is executing the given block.
         
     | 
| 
      
 38 
     | 
    
         
            +
            	#
         
     | 
| 
      
 39 
     | 
    
         
            +
            	# @public Since `stable-v1`.
         
     | 
| 
      
 40 
     | 
    
         
            +
            	# @asynchronous May block until given block completes executing.
         
     | 
| 
      
 41 
     | 
    
         
            +
            	def Async(...)
         
     | 
| 
      
 42 
     | 
    
         
            +
            		if current = ::Async::Task.current?
         
     | 
| 
      
 43 
     | 
    
         
            +
            			return current.async(...)
         
     | 
| 
      
 44 
     | 
    
         
            +
            		else
         
     | 
| 
      
 45 
     | 
    
         
            +
            			reactor = ::Async::Reactor.new
         
     | 
| 
      
 46 
     | 
    
         
            +
            			
         
     | 
| 
      
 47 
     | 
    
         
            +
            			begin
         
     | 
| 
      
 48 
     | 
    
         
            +
            				return reactor.run(...)
         
     | 
| 
      
 49 
     | 
    
         
            +
            			ensure
         
     | 
| 
      
 50 
     | 
    
         
            +
            				Fiber.set_scheduler(nil)
         
     | 
| 
      
 51 
     | 
    
         
            +
            			end
         
     | 
| 
      
 52 
     | 
    
         
            +
            		end
         
     | 
| 
       29 
53 
     | 
    
         
             
            	end
         
     | 
| 
       30 
54 
     | 
    
         
             
            end
         
     | 
    
        data/lib/kernel/sync.rb
    CHANGED
    
    | 
         @@ -22,16 +22,26 @@ 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            require_relative "../async/reactor"
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
      
 25 
     | 
    
         
            +
            # Extensions to all Ruby objects.
         
     | 
| 
       25 
26 
     | 
    
         
             
            module Kernel
         
     | 
| 
       26 
27 
     | 
    
         
             
            	# Run the given block of code synchronously, but within a reactor if not already in one.
         
     | 
| 
      
 28 
     | 
    
         
            +
            	#
         
     | 
| 
      
 29 
     | 
    
         
            +
            	# @yields {|task| ...} The block that will execute asynchronously.
         
     | 
| 
      
 30 
     | 
    
         
            +
            	# 	@parameter task [Async::Task] The task that is executing the given block.
         
     | 
| 
      
 31 
     | 
    
         
            +
            	#
         
     | 
| 
      
 32 
     | 
    
         
            +
            	# @public Since `stable-v1`.
         
     | 
| 
      
 33 
     | 
    
         
            +
            	# @asynchronous Will block until given block completes executing.
         
     | 
| 
       27 
34 
     | 
    
         
             
            	def Sync(&block)
         
     | 
| 
       28 
35 
     | 
    
         
             
            		if task = ::Async::Task.current?
         
     | 
| 
       29 
36 
     | 
    
         
             
            			yield task
         
     | 
| 
       30 
37 
     | 
    
         
             
            		else
         
     | 
| 
       31 
     | 
    
         
            -
            			 
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 38 
     | 
    
         
            +
            			reactor = Async::Reactor.new
         
     | 
| 
      
 39 
     | 
    
         
            +
            			
         
     | 
| 
      
 40 
     | 
    
         
            +
            			begin
         
     | 
| 
      
 41 
     | 
    
         
            +
            				return reactor.run(finished: ::Async::Condition.new, &block).wait
         
     | 
| 
      
 42 
     | 
    
         
            +
            			ensure
         
     | 
| 
      
 43 
     | 
    
         
            +
            				Fiber.set_scheduler(nil)
         
     | 
| 
      
 44 
     | 
    
         
            +
            			end
         
     | 
| 
       35 
45 
     | 
    
         
             
            		end
         
     | 
| 
       36 
46 
     | 
    
         
             
            	end
         
     | 
| 
       37 
47 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: async
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version:  
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Samuel Williams
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-12-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: console
         
     | 
| 
         @@ -25,19 +25,19 @@ dependencies: 
     | 
|
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
26 
     | 
    
         
             
                    version: '1.10'
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
     | 
    
         
            -
              name:  
     | 
| 
      
 28 
     | 
    
         
            +
              name: io-event
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
31 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version:  
     | 
| 
      
 33 
     | 
    
         
            +
                    version: 1.0.0
         
     | 
| 
       34 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
38 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version:  
     | 
| 
      
 40 
     | 
    
         
            +
                    version: 1.0.0
         
     | 
| 
       41 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
42 
     | 
    
         
             
              name: timers
         
     | 
| 
       43 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -143,17 +143,17 @@ extensions: [] 
     | 
|
| 
       143 
143 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       144 
144 
     | 
    
         
             
            files:
         
     | 
| 
       145 
145 
     | 
    
         
             
            - lib/async.rb
         
     | 
| 
      
 146 
     | 
    
         
            +
            - lib/async/barrier.md
         
     | 
| 
       146 
147 
     | 
    
         
             
            - lib/async/barrier.rb
         
     | 
| 
       147 
148 
     | 
    
         
             
            - lib/async/clock.rb
         
     | 
| 
      
 149 
     | 
    
         
            +
            - lib/async/condition.md
         
     | 
| 
       148 
150 
     | 
    
         
             
            - lib/async/condition.rb
         
     | 
| 
       149 
     | 
    
         
            -
            - lib/async/debug/monitor.rb
         
     | 
| 
       150 
     | 
    
         
            -
            - lib/async/debug/selector.rb
         
     | 
| 
       151 
     | 
    
         
            -
            - lib/async/logger.rb
         
     | 
| 
       152 
151 
     | 
    
         
             
            - lib/async/node.rb
         
     | 
| 
       153 
152 
     | 
    
         
             
            - lib/async/notification.rb
         
     | 
| 
       154 
153 
     | 
    
         
             
            - lib/async/queue.rb
         
     | 
| 
       155 
154 
     | 
    
         
             
            - lib/async/reactor.rb
         
     | 
| 
       156 
155 
     | 
    
         
             
            - lib/async/scheduler.rb
         
     | 
| 
      
 156 
     | 
    
         
            +
            - lib/async/semaphore.md
         
     | 
| 
       157 
157 
     | 
    
         
             
            - lib/async/semaphore.rb
         
     | 
| 
       158 
158 
     | 
    
         
             
            - lib/async/task.rb
         
     | 
| 
       159 
159 
     | 
    
         
             
            - lib/async/variable.rb
         
     | 
| 
         @@ -173,14 +173,14 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       173 
173 
     | 
    
         
             
              requirements:
         
     | 
| 
       174 
174 
     | 
    
         
             
              - - ">="
         
     | 
| 
       175 
175 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       176 
     | 
    
         
            -
                  version:  
     | 
| 
      
 176 
     | 
    
         
            +
                  version: 3.1.0
         
     | 
| 
       177 
177 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       178 
178 
     | 
    
         
             
              requirements:
         
     | 
| 
       179 
179 
     | 
    
         
             
              - - ">="
         
     | 
| 
       180 
180 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       181 
181 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       182 
182 
     | 
    
         
             
            requirements: []
         
     | 
| 
       183 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 183 
     | 
    
         
            +
            rubygems_version: 3.3.3
         
     | 
| 
       184 
184 
     | 
    
         
             
            signing_key:
         
     | 
| 
       185 
185 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       186 
186 
     | 
    
         
             
            summary: A concurrency framework for Ruby.
         
     | 
    
        data/lib/async/debug/monitor.rb
    DELETED
    
    | 
         @@ -1,47 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
         
     | 
| 
       4 
     | 
    
         
            -
            # 
         
     | 
| 
       5 
     | 
    
         
            -
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       6 
     | 
    
         
            -
            # of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
       7 
     | 
    
         
            -
            # in the Software without restriction, including without limitation the rights
         
     | 
| 
       8 
     | 
    
         
            -
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
       9 
     | 
    
         
            -
            # copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
       10 
     | 
    
         
            -
            # furnished to do so, subject to the following conditions:
         
     | 
| 
       11 
     | 
    
         
            -
            # 
         
     | 
| 
       12 
     | 
    
         
            -
            # The above copyright notice and this permission notice shall be included in
         
     | 
| 
       13 
     | 
    
         
            -
            # all copies or substantial portions of the Software.
         
     | 
| 
       14 
     | 
    
         
            -
            # 
         
     | 
| 
       15 
     | 
    
         
            -
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
       16 
     | 
    
         
            -
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
       17 
     | 
    
         
            -
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
       18 
     | 
    
         
            -
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
       19 
     | 
    
         
            -
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
       20 
     | 
    
         
            -
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
       21 
     | 
    
         
            -
            # THE SOFTWARE.
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            require 'delegate'
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
            module Async
         
     | 
| 
       26 
     | 
    
         
            -
            	module Debug
         
     | 
| 
       27 
     | 
    
         
            -
            		class Monitor < Delegator
         
     | 
| 
       28 
     | 
    
         
            -
            			def initialize(monitor, selector)
         
     | 
| 
       29 
     | 
    
         
            -
            				@monitor = monitor
         
     | 
| 
       30 
     | 
    
         
            -
            				@selector = selector
         
     | 
| 
       31 
     | 
    
         
            -
            			end
         
     | 
| 
       32 
     | 
    
         
            -
            			
         
     | 
| 
       33 
     | 
    
         
            -
            			def __getobj__
         
     | 
| 
       34 
     | 
    
         
            -
            				@monitor
         
     | 
| 
       35 
     | 
    
         
            -
            			end
         
     | 
| 
       36 
     | 
    
         
            -
            			
         
     | 
| 
       37 
     | 
    
         
            -
            			def close
         
     | 
| 
       38 
     | 
    
         
            -
            				@selector.deregister(self)
         
     | 
| 
       39 
     | 
    
         
            -
            				@monitor.close
         
     | 
| 
       40 
     | 
    
         
            -
            			end
         
     | 
| 
       41 
     | 
    
         
            -
            			
         
     | 
| 
       42 
     | 
    
         
            -
            			def inspect
         
     | 
| 
       43 
     | 
    
         
            -
            				"\#<#{self.class} io=#{@monitor.io.inspect} interests=#{@monitor.interests.inspect} readiness=#{@monitor.readiness.inspect}>"
         
     | 
| 
       44 
     | 
    
         
            -
            			end
         
     | 
| 
       45 
     | 
    
         
            -
            		end
         
     | 
| 
       46 
     | 
    
         
            -
            	end
         
     | 
| 
       47 
     | 
    
         
            -
            end
         
     | 
    
        data/lib/async/debug/selector.rb
    DELETED
    
    | 
         @@ -1,82 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
         
     | 
| 
       4 
     | 
    
         
            -
            # 
         
     | 
| 
       5 
     | 
    
         
            -
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       6 
     | 
    
         
            -
            # of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
       7 
     | 
    
         
            -
            # in the Software without restriction, including without limitation the rights
         
     | 
| 
       8 
     | 
    
         
            -
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
       9 
     | 
    
         
            -
            # copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
       10 
     | 
    
         
            -
            # furnished to do so, subject to the following conditions:
         
     | 
| 
       11 
     | 
    
         
            -
            # 
         
     | 
| 
       12 
     | 
    
         
            -
            # The above copyright notice and this permission notice shall be included in
         
     | 
| 
       13 
     | 
    
         
            -
            # all copies or substantial portions of the Software.
         
     | 
| 
       14 
     | 
    
         
            -
            # 
         
     | 
| 
       15 
     | 
    
         
            -
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
       16 
     | 
    
         
            -
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
       17 
     | 
    
         
            -
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
       18 
     | 
    
         
            -
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
       19 
     | 
    
         
            -
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
       20 
     | 
    
         
            -
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
       21 
     | 
    
         
            -
            # THE SOFTWARE.
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            require_relative 'monitor'
         
     | 
| 
       24 
     | 
    
         
            -
            require_relative '../logger'
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
            require 'nio'
         
     | 
| 
       27 
     | 
    
         
            -
            require 'set'
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
            module Async
         
     | 
| 
       30 
     | 
    
         
            -
            	module Debug
         
     | 
| 
       31 
     | 
    
         
            -
            		class LeakError < RuntimeError
         
     | 
| 
       32 
     | 
    
         
            -
            			def initialize(monitors)
         
     | 
| 
       33 
     | 
    
         
            -
            				super "Trying to close selector with active monitors: #{monitors.inspect}! This may cause your socket or file descriptor to leak."
         
     | 
| 
       34 
     | 
    
         
            -
            			end
         
     | 
| 
       35 
     | 
    
         
            -
            		end
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
            		class Selector
         
     | 
| 
       38 
     | 
    
         
            -
            			def initialize(selector = NIO::Selector.new)
         
     | 
| 
       39 
     | 
    
         
            -
            				@selector = selector
         
     | 
| 
       40 
     | 
    
         
            -
            				@monitors = Set.new
         
     | 
| 
       41 
     | 
    
         
            -
            			end
         
     | 
| 
       42 
     | 
    
         
            -
            			
         
     | 
| 
       43 
     | 
    
         
            -
            			def register(object, interests)
         
     | 
| 
       44 
     | 
    
         
            -
            				Async.logger.debug(self) {"Registering #{object.inspect} for #{interests}."}
         
     | 
| 
       45 
     | 
    
         
            -
            				
         
     | 
| 
       46 
     | 
    
         
            -
            				unless io = ::IO.try_convert(object)
         
     | 
| 
       47 
     | 
    
         
            -
            					raise RuntimeError, "Could not convert #{io} into IO!"
         
     | 
| 
       48 
     | 
    
         
            -
            				end
         
     | 
| 
       49 
     | 
    
         
            -
            				
         
     | 
| 
       50 
     | 
    
         
            -
            				monitor = Monitor.new(@selector.register(object, interests), self)
         
     | 
| 
       51 
     | 
    
         
            -
            				
         
     | 
| 
       52 
     | 
    
         
            -
            				@monitors.add(monitor)
         
     | 
| 
       53 
     | 
    
         
            -
            				
         
     | 
| 
       54 
     | 
    
         
            -
            				return monitor
         
     | 
| 
       55 
     | 
    
         
            -
            			end
         
     | 
| 
       56 
     | 
    
         
            -
            			
         
     | 
| 
       57 
     | 
    
         
            -
            			def deregister(monitor)
         
     | 
| 
       58 
     | 
    
         
            -
            				Async.logger.debug(self) {"Deregistering #{monitor.inspect}."}
         
     | 
| 
       59 
     | 
    
         
            -
            				
         
     | 
| 
       60 
     | 
    
         
            -
            				unless @monitors.delete?(monitor)
         
     | 
| 
       61 
     | 
    
         
            -
            					raise RuntimeError, "Trying to remove monitor for #{monitor.inspect} but it was not registered!"
         
     | 
| 
       62 
     | 
    
         
            -
            				end
         
     | 
| 
       63 
     | 
    
         
            -
            			end
         
     | 
| 
       64 
     | 
    
         
            -
            			
         
     | 
| 
       65 
     | 
    
         
            -
            			def wakeup
         
     | 
| 
       66 
     | 
    
         
            -
            				@selector.wakeup
         
     | 
| 
       67 
     | 
    
         
            -
            			end
         
     | 
| 
       68 
     | 
    
         
            -
            			
         
     | 
| 
       69 
     | 
    
         
            -
            			def close
         
     | 
| 
       70 
     | 
    
         
            -
            				if @monitors.any?
         
     | 
| 
       71 
     | 
    
         
            -
            					raise LeakError, @monitors
         
     | 
| 
       72 
     | 
    
         
            -
            				end
         
     | 
| 
       73 
     | 
    
         
            -
            			ensure
         
     | 
| 
       74 
     | 
    
         
            -
            				@selector.close
         
     | 
| 
       75 
     | 
    
         
            -
            			end
         
     | 
| 
       76 
     | 
    
         
            -
            			
         
     | 
| 
       77 
     | 
    
         
            -
            			def select(*arguments)
         
     | 
| 
       78 
     | 
    
         
            -
            				@selector.select(*arguments)
         
     | 
| 
       79 
     | 
    
         
            -
            			end
         
     | 
| 
       80 
     | 
    
         
            -
            		end
         
     | 
| 
       81 
     | 
    
         
            -
            	end
         
     | 
| 
       82 
     | 
    
         
            -
            end
         
     | 
    
        data/lib/async/logger.rb
    DELETED
    
    | 
         @@ -1,28 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
         
     | 
| 
       4 
     | 
    
         
            -
            # 
         
     | 
| 
       5 
     | 
    
         
            -
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       6 
     | 
    
         
            -
            # of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
       7 
     | 
    
         
            -
            # in the Software without restriction, including without limitation the rights
         
     | 
| 
       8 
     | 
    
         
            -
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
       9 
     | 
    
         
            -
            # copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
       10 
     | 
    
         
            -
            # furnished to do so, subject to the following conditions:
         
     | 
| 
       11 
     | 
    
         
            -
            # 
         
     | 
| 
       12 
     | 
    
         
            -
            # The above copyright notice and this permission notice shall be included in
         
     | 
| 
       13 
     | 
    
         
            -
            # all copies or substantial portions of the Software.
         
     | 
| 
       14 
     | 
    
         
            -
            # 
         
     | 
| 
       15 
     | 
    
         
            -
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
       16 
     | 
    
         
            -
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
       17 
     | 
    
         
            -
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
       18 
     | 
    
         
            -
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
       19 
     | 
    
         
            -
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
       20 
     | 
    
         
            -
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
       21 
     | 
    
         
            -
            # THE SOFTWARE.
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            require 'console'
         
     | 
| 
       24 
     | 
    
         
            -
            require_relative 'task'
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
            module Async
         
     | 
| 
       27 
     | 
    
         
            -
            	extend Console
         
     | 
| 
       28 
     | 
    
         
            -
            end
         
     |