async 2.40.0 → 2.41.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
- checksums.yaml.gz.sig +0 -0
- data/lib/async/scheduler.rb +22 -3
- data/lib/async/version.rb +1 -1
- data/lib/kernel/sync.rb +1 -2
- data/readme.md +4 -4
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: c707fb6001b639a32c63b2eac330cde48e8d411dc766fca44b98816991f4daea
|
|
4
|
+
data.tar.gz: cff7be5da559c06c9d040717057270d9e2369f26b9ac481fa56e92d8383103b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ff5660626ce3c460bfe1b5796185a3421c5b060da99624a0fcf8943e2a634c5c5f1919ca281d29debaf04687ed5be6b7f70c36cf63a12bd96a776a06ec7e3ac
|
|
7
|
+
data.tar.gz: c5d0a80e1f6795afabd7b0ae1f5dda8d3d9f5083be0cbb2b5cb121977e389b68c71ef87e875d521bed65080652be5e5843061f32247a6bab35ef20e1d06e5484
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/async/scheduler.rb
CHANGED
|
@@ -525,12 +525,25 @@ module Async
|
|
|
525
525
|
cancel
|
|
526
526
|
end
|
|
527
527
|
|
|
528
|
-
|
|
528
|
+
# Run the event loop, until the scheduler is interrupted or finished.
|
|
529
|
+
#
|
|
530
|
+
# @parameter initial [Proc | Nil] The initial block to execute before the first loop iteration.
|
|
531
|
+
# @yields {...} The block to execute on each loop iteration.
|
|
532
|
+
# @raises {Interrupt} If the scheduler is interrupted.
|
|
533
|
+
private def run_loop(initial = nil, &block)
|
|
529
534
|
interrupt = nil
|
|
530
535
|
|
|
531
536
|
begin
|
|
532
537
|
# 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.
|
|
533
538
|
Thread.handle_interrupt(::SignalException => :never) do
|
|
539
|
+
if initial
|
|
540
|
+
begin
|
|
541
|
+
initial.call
|
|
542
|
+
ensure
|
|
543
|
+
initial = nil
|
|
544
|
+
end
|
|
545
|
+
end
|
|
546
|
+
|
|
534
547
|
until self.interrupted?
|
|
535
548
|
# If we are finished, we need to exit:
|
|
536
549
|
break unless yield
|
|
@@ -570,9 +583,15 @@ module Async
|
|
|
570
583
|
begin
|
|
571
584
|
@profiler&.start
|
|
572
585
|
|
|
573
|
-
initial_task =
|
|
586
|
+
initial_task = nil
|
|
574
587
|
|
|
575
|
-
|
|
588
|
+
if block_given?
|
|
589
|
+
initial = proc do
|
|
590
|
+
initial_task = self.async(...)
|
|
591
|
+
end
|
|
592
|
+
end
|
|
593
|
+
|
|
594
|
+
self.run_loop(initial) do
|
|
576
595
|
run_once
|
|
577
596
|
end
|
|
578
597
|
|
data/lib/async/version.rb
CHANGED
data/lib/kernel/sync.rb
CHANGED
|
@@ -32,8 +32,7 @@ module Kernel
|
|
|
32
32
|
|
|
33
33
|
begin
|
|
34
34
|
# Use finished: false to suppress warnings since we're handling exceptions explicitly
|
|
35
|
-
task = reactor.
|
|
36
|
-
reactor.run
|
|
35
|
+
task = reactor.run(annotation: annotation, finished: false, &block)
|
|
37
36
|
return task.wait
|
|
38
37
|
ensure
|
|
39
38
|
Fiber.set_scheduler(nil)
|
data/readme.md
CHANGED
|
@@ -35,6 +35,10 @@ Please see the [project documentation](https://socketry.github.io/async/) for mo
|
|
|
35
35
|
|
|
36
36
|
Please see the [project releases](https://socketry.github.io/async/releases/index) for all releases.
|
|
37
37
|
|
|
38
|
+
### v2.41.0
|
|
39
|
+
|
|
40
|
+
- **Fixed**: Protect initial task from Interrupt exceptions.
|
|
41
|
+
|
|
38
42
|
### v2.40.0
|
|
39
43
|
|
|
40
44
|
- Introduce `Async::Condition#waiting_count`. This allows you to see how many tasks are currently waiting on the condition, which can be useful for debugging and monitoring purposes.
|
|
@@ -75,10 +79,6 @@ Please see the [project releases](https://socketry.github.io/async/releases/inde
|
|
|
75
79
|
|
|
76
80
|
- Fix incorrect handling of spurious wakeups in `Async::Promise#wait`, which could lead to premature (incorrect) resolution of the promise.
|
|
77
81
|
|
|
78
|
-
### v2.35.0
|
|
79
|
-
|
|
80
|
-
- `Process.fork` is now properly handled by the Async fiber scheduler, ensuring that the scheduler state is correctly reset in the child process after a fork. This prevents issues where the child process inherits the scheduler state from the parent, which could lead to unexpected behavior.
|
|
81
|
-
|
|
82
82
|
## See Also
|
|
83
83
|
|
|
84
84
|
- [async-http](https://github.com/socketry/async-http) — Asynchronous HTTP client/server.
|
data/releases.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v2.41.0
|
|
4
|
+
|
|
5
|
+
- **Fixed**: Protect initial task from Interrupt exceptions.
|
|
6
|
+
|
|
3
7
|
## v2.40.0
|
|
4
8
|
|
|
5
9
|
- Introduce `Async::Condition#waiting_count`. This allows you to see how many tasks are currently waiting on the condition, which can be useful for debugging and monitoring purposes.
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|