async 2.6.0 → 2.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f62c8150ba7dba6f26532b080a4c99ecde97d86cf5f31746aec706d12644550
4
- data.tar.gz: 99bbe4f65da2c18ab75bc67377896b7b6c26f6056eb789ef22d5601f43526228
3
+ metadata.gz: 7ca106126076f17e48b0374812121cb9d30bc9e5eac981b52407db946ce41e00
4
+ data.tar.gz: '0302068031a9aee009ec0fbf1a5045fdae48031f4c2f2ff1914f45c292dd6915'
5
5
  SHA512:
6
- metadata.gz: 3c6a7fee5fb6d429b7533afb80dd38ad499c8dd313ee5f881cdd19479a8f1f28072f16f07f83305f6d2e6ddaa7907859938fcd69e2fc7b0e945b194588fd22e2
7
- data.tar.gz: f10a739ba6013c928199c4abe884e9dbf9d4d48d7f8329ed3977bb9230584d100505d617a859c113bf04c25cbf9ae4353e525221563f930227467cbaebf153b1
6
+ metadata.gz: 865d56ad3386151e7f417fe00343946be99ae60d620948718e28856aa59fc7f82e8ba28debebb3d025c3a852878456b940dc7e99a1f3a7591873ac7d3a139b2b
7
+ data.tar.gz: 90d108eb53e337ad33b8655c70aaeb22acc64eba534a7096cd9053938ab3654858e4a72a7d2872ffaaa7c708ba2049c629c30a7a00ace4b370f799e99da85525
checksums.yaml.gz.sig CHANGED
Binary file
@@ -50,7 +50,7 @@ module Async
50
50
  def close
51
51
  # It's critical to stop all tasks. Otherwise they might be holding on to resources which are never closed/released correctly.
52
52
  until self.terminate
53
- self.run_once
53
+ self.run_once!
54
54
  end
55
55
 
56
56
  Kernel.raise "Closing scheduler with blocked operations!" if @blocked > 0
@@ -215,6 +215,16 @@ module Async
215
215
  return false
216
216
  end
217
217
 
218
+ return run_once!(timeout)
219
+ end
220
+
221
+ # Run one iteration of the event loop.
222
+ #
223
+ # When terminating the event loop, we already know we are finished. So we don't need to check the task tree. This is a logical requirement because `run_once` ignores transient tasks. For example, a single top level transient task is not enough to keep the reactor running, but during termination we must still process it in order to terminate child tasks.
224
+ #
225
+ # @parameter timeout [Float | Nil] The maximum timeout, or if nil, indefinite.
226
+ # @returns [Boolean] Whether there is more work to do.
227
+ private def run_once!(timeout = 0)
218
228
  interval = @timers.wait_interval
219
229
 
220
230
  # If there is no interval to wait (thus no timers), and no tasks, we could be done:
@@ -248,9 +258,12 @@ module Async
248
258
 
249
259
  @interrupted = false
250
260
 
251
- while self.run_once
252
- if @interrupted
253
- break
261
+ # In theory, we could use Exception here to be a little bit safer, but we've only shown the case for SignalException to be a problem, so let's not over-engineer this.
262
+ Thread.handle_interrupt(SignalException => :never) do
263
+ while self.run_once
264
+ if @interrupted || Thread.pending_interrupt?
265
+ break
266
+ end
254
267
  end
255
268
  end
256
269
 
data/lib/async/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2017-2022, by Samuel Williams.
5
5
 
6
6
  module Async
7
- VERSION = "2.6.0"
7
+ VERSION = "2.6.2"
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -56,7 +56,7 @@ cert_chain:
56
56
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
57
57
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
58
58
  -----END CERTIFICATE-----
59
- date: 2023-06-07 00:00:00.000000000 Z
59
+ date: 2023-06-13 00:00:00.000000000 Z
60
60
  dependencies:
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: console
metadata.gz.sig CHANGED
Binary file