async 2.39.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 +4 -3
- data/lib/async/condition.rb +5 -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 +8 -8
- data/releases.md +8 -0
- 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: 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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
��Z>��o���IL˱�0�����1���z�O����uhκ���$�m�φ����.�������^��!���z%e6�纻y��|��X�`��I_����_"^�"ˈ�<���0](�Z[��
|
|
2
|
+
,�����Qޕ�}fR�T����X����A!�^
|
|
3
|
+
��tv�7��R\68t>�Yf�xL��|�Ud�\����9�l�b��h��t]������\s4E���w�����GGg���aΡ�����]����C�1PL�',!�u�x^벏bS�R��0=��=�cY��k��c��ٛ�?#q�
|
|
4
|
+
z�@�
|
data/lib/async/condition.rb
CHANGED
|
@@ -32,6 +32,11 @@ module Async
|
|
|
32
32
|
!self.empty?
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
# @returns [Integer] Number of fibers waiting on this condition.
|
|
36
|
+
def waiting_count
|
|
37
|
+
@ready.num_waiting
|
|
38
|
+
end
|
|
39
|
+
|
|
35
40
|
# Signal to a given task that it should resume operations.
|
|
36
41
|
# @parameter value [Object | Nil] The value to return to the waiting fibers.
|
|
37
42
|
def signal(value = nil)
|
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,14 @@ 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
|
+
|
|
42
|
+
### v2.40.0
|
|
43
|
+
|
|
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.
|
|
45
|
+
|
|
38
46
|
### v2.39.0
|
|
39
47
|
|
|
40
48
|
- `Async::Barrier#wait` now returns the number of tasks that were waited for, or `nil` if there were no tasks to wait for. This provides better feedback about the operation, and allows you to know how many tasks were involved in the wait.
|
|
@@ -71,14 +79,6 @@ Please see the [project releases](https://socketry.github.io/async/releases/inde
|
|
|
71
79
|
|
|
72
80
|
- Fix incorrect handling of spurious wakeups in `Async::Promise#wait`, which could lead to premature (incorrect) resolution of the promise.
|
|
73
81
|
|
|
74
|
-
### v2.35.0
|
|
75
|
-
|
|
76
|
-
- `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.
|
|
77
|
-
|
|
78
|
-
### v2.34.0
|
|
79
|
-
|
|
80
|
-
- [`Kernel::Barrier` Convenience Interface](https://socketry.github.io/async/releases/index#kernel::barrier-convenience-interface)
|
|
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,13 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v2.41.0
|
|
4
|
+
|
|
5
|
+
- **Fixed**: Protect initial task from Interrupt exceptions.
|
|
6
|
+
|
|
7
|
+
## v2.40.0
|
|
8
|
+
|
|
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.
|
|
10
|
+
|
|
3
11
|
## v2.39.0
|
|
4
12
|
|
|
5
13
|
- `Async::Barrier#wait` now returns the number of tasks that were waited for, or `nil` if there were no tasks to wait for. This provides better feedback about the operation, and allows you to know how many tasks were involved in the wait.
|
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.
|
|
4
|
+
version: 2.41.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
216
216
|
- !ruby/object:Gem::Version
|
|
217
217
|
version: '0'
|
|
218
218
|
requirements: []
|
|
219
|
-
rubygems_version:
|
|
219
|
+
rubygems_version: 4.0.10
|
|
220
220
|
specification_version: 4
|
|
221
221
|
summary: A concurrency framework for Ruby.
|
|
222
222
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|