async 2.15.1 → 2.15.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/async/task.rb +21 -12
- data/lib/async/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7830bab72d5bdd68def8fe84b914785f191e29dc3f2d0b8f6d58d91878ff72d
|
4
|
+
data.tar.gz: c54b09d668152d3183ab8b366b75cc09c0e441a54914540896326e87b09a5fe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 512e6fd4c720c19817bc95db9a7eb85f710314834cc655c9c1e43bac98831aab0802f9ef568de8e2308d1bb0a0304d6f3f4e2e8a465561ec20f79ac2644246d8
|
7
|
+
data.tar.gz: a0b8dae781660179da1a6ca0b766cbfdba8089684931cc95ea17e1dbf17667b96b34386e50fdceea97768af511dbbc6bbf90140c1027f53adc4db0a81e7d23bc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/async/task.rb
CHANGED
@@ -253,18 +253,18 @@ module Async
|
|
253
253
|
return stopped!
|
254
254
|
end
|
255
255
|
|
256
|
-
# If we are deferring stop...
|
257
|
-
if @defer_stop == false
|
258
|
-
# Don't stop now... but update the state so we know we need to stop later.
|
259
|
-
@defer_stop = true
|
260
|
-
return false
|
261
|
-
end
|
262
|
-
|
263
256
|
# If the fiber is alive, we need to stop it:
|
264
257
|
if @fiber&.alive?
|
265
258
|
# As the task is now exiting, we want to ensure the event loop continues to execute until the task finishes.
|
266
259
|
self.transient = false
|
267
260
|
|
261
|
+
# If we are deferring stop...
|
262
|
+
if @defer_stop == false
|
263
|
+
# Don't stop now... but update the state so we know we need to stop later.
|
264
|
+
@defer_stop = true
|
265
|
+
return false
|
266
|
+
end
|
267
|
+
|
268
268
|
if self.current?
|
269
269
|
# If the fiber is current, and later is `true`, we need to schedule the fiber to be stopped later, as it's currently invoking `stop`:
|
270
270
|
if later
|
@@ -304,19 +304,23 @@ module Async
|
|
304
304
|
# - false: defer_stop has been called and we are not stopping.
|
305
305
|
# - true: defer_stop has been called and we will stop when exiting the block.
|
306
306
|
if @defer_stop.nil?
|
307
|
-
# If we are not deferring stop already, we can defer it now:
|
308
|
-
@defer_stop = false
|
309
|
-
|
310
307
|
begin
|
308
|
+
# If we are not deferring stop already, we can defer it now:
|
309
|
+
@defer_stop = false
|
310
|
+
|
311
311
|
yield
|
312
312
|
rescue Stop
|
313
313
|
# If we are exiting due to a stop, we shouldn't try to invoke stop again:
|
314
314
|
@defer_stop = nil
|
315
315
|
raise
|
316
316
|
ensure
|
317
|
+
defer_stop = @defer_stop
|
318
|
+
|
319
|
+
# We need to ensure the state is reset before we exit the block:
|
320
|
+
@defer_stop = nil
|
321
|
+
|
317
322
|
# If we were asked to stop, we should do so now:
|
318
|
-
if
|
319
|
-
@defer_stop = nil
|
323
|
+
if defer_stop
|
320
324
|
raise Stop, "Stopping current task (was deferred)!"
|
321
325
|
end
|
322
326
|
end
|
@@ -326,6 +330,11 @@ module Async
|
|
326
330
|
end
|
327
331
|
end
|
328
332
|
|
333
|
+
# @returns [Boolean] Whether stop has been deferred.
|
334
|
+
def stop_deferred?
|
335
|
+
@defer_stop
|
336
|
+
end
|
337
|
+
|
329
338
|
# Lookup the {Task} for the current fiber. Raise `RuntimeError` if none is available.
|
330
339
|
# @returns [Task]
|
331
340
|
# @raises[RuntimeError] If task was not {set!} for the current fiber.
|
data/lib/async/version.rb
CHANGED
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.15.
|
4
|
+
version: 2.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -63,7 +63,7 @@ cert_chain:
|
|
63
63
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
64
64
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
65
65
|
-----END CERTIFICATE-----
|
66
|
-
date: 2024-08-
|
66
|
+
date: 2024-08-08 00:00:00.000000000 Z
|
67
67
|
dependencies:
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
69
|
name: console
|
metadata.gz.sig
CHANGED
Binary file
|