async 2.43.0 → 2.44.1
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/context/getting-started.md +36 -0
- data/context/index.yaml +2 -0
- data/lib/async/condition.rb +1 -1
- data/lib/async/scheduler.rb +1 -0
- data/lib/async/version.rb +1 -1
- data/lib/kernel/async.rb +1 -1
- data/lib/kernel/sync.rb +1 -1
- data/readme.md +4 -4
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +3 -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: 0a98ba175586bacb13a3f00ccb770083208e4c8381cbaf17ce4f59fdfc56a85a
|
|
4
|
+
data.tar.gz: 6a8614f33cbfa4230e66e12750308a1a339d9a2d6fe8a624b015498c5bc60928
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d3c4cd7e58f0eb601e37ffbf8d415c6b66349f268f2b9bec37ed4a945744409ecdb21f13e101cacba2794ea1dd3e6dd3be7a5cf7ca6cc5e67cd557bd65cd11e
|
|
7
|
+
data.tar.gz: dc2c1d73dc53df633260e279a20f8cbcb4c40c94b362fc383495e020f750807624c2de5bff446732585b5e2b4121b0ec382de65983db3af23301e937b96b4074
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/context/getting-started.md
CHANGED
|
@@ -74,6 +74,42 @@ end
|
|
|
74
74
|
puts "The number was: #{task.wait}"
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
### Comparing `Async` and `Sync`
|
|
78
|
+
|
|
79
|
+
If you are familiar with JavaScript's `async`/`await`, `Async{...}` is similar to calling an asynchronous function: it starts the work and returns a promise-like {ruby Async::Task} that you can wait on later.
|
|
80
|
+
|
|
81
|
+
```ruby
|
|
82
|
+
task = Async do
|
|
83
|
+
bar
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
task.wait # Returns the value of bar.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
This is similar to JavaScript code that keeps the promise:
|
|
90
|
+
|
|
91
|
+
```javascript
|
|
92
|
+
const promise = bar();
|
|
93
|
+
|
|
94
|
+
await promise; // Returns the value of bar.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`Sync{...}` is similar to immediately awaiting that work: it runs the block in an event loop and returns the block's value directly.
|
|
98
|
+
|
|
99
|
+
```ruby
|
|
100
|
+
result = Sync do
|
|
101
|
+
bar
|
|
102
|
+
end
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This is similar to:
|
|
106
|
+
|
|
107
|
+
```javascript
|
|
108
|
+
const result = await bar();
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The main difference is that JavaScript starts with an event loop already available, while Ruby code needs one to be provided by a fiber scheduler. `Sync{...}` is the usual way to create or reuse that event loop when the caller wants a direct return value instead of a task.
|
|
112
|
+
|
|
77
113
|
## Creating a Fiber Scheduler
|
|
78
114
|
|
|
79
115
|
The first (top level) async block will also create an instance of {ruby Async::Reactor} which is a subclass of {ruby Async::Scheduler} to handle the event loop. You can also do this directly using {ruby Fiber.set_scheduler}:
|
data/context/index.yaml
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
---
|
|
4
4
|
description: A concurrency framework for Ruby.
|
|
5
5
|
metadata:
|
|
6
|
+
bug_tracker_uri: https://github.com/socketry/async/issues
|
|
7
|
+
changelog_uri: https://github.com/socketry/async/blob/main/releases.md
|
|
6
8
|
documentation_uri: https://socketry.github.io/async/
|
|
7
9
|
funding_uri: https://github.com/sponsors/ioquatix/
|
|
8
10
|
source_code_uri: https://github.com/socketry/async.git
|
data/lib/async/condition.rb
CHANGED
data/lib/async/scheduler.rb
CHANGED
data/lib/async/version.rb
CHANGED
data/lib/kernel/async.rb
CHANGED
data/lib/kernel/sync.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# Released under the MIT License.
|
|
4
|
-
# Copyright, 2019-
|
|
4
|
+
# Copyright, 2019-2026, by Samuel Williams.
|
|
5
5
|
# Copyright, 2020, by Brian Morearty.
|
|
6
6
|
# Copyright, 2024, by Patrik Wenger.
|
|
7
7
|
# Copyright, 2025-2026, by Shopify Inc.
|
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.44.0
|
|
39
|
+
|
|
40
|
+
- Fixed scheduler cleanup after forking while other fibers are blocked.
|
|
41
|
+
|
|
38
42
|
### v2.43.0
|
|
39
43
|
|
|
40
44
|
- Propagate cancellation causes through task trees so child tasks observe the original cancellation cause.
|
|
@@ -74,10 +78,6 @@ Please see the [project releases](https://socketry.github.io/async/releases/inde
|
|
|
74
78
|
- Introduce `Task#wait_all` which recursively waits for all children and self, excepting the current task.
|
|
75
79
|
- Introduce `Task#join` as an alias for `Task#wait` for compatibility with `Thread#join` and similar interfaces.
|
|
76
80
|
|
|
77
|
-
### v2.35.3
|
|
78
|
-
|
|
79
|
-
- `Async::Clock` now implements `#as_json` and `#to_json` for nicer log formatting.
|
|
80
|
-
|
|
81
81
|
## See Also
|
|
82
82
|
|
|
83
83
|
- [async-http](https://github.com/socketry/async-http) — Asynchronous HTTP client/server.
|
data/releases.md
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.
|
|
4
|
+
version: 2.44.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -173,6 +173,8 @@ homepage: https://github.com/socketry/async
|
|
|
173
173
|
licenses:
|
|
174
174
|
- MIT
|
|
175
175
|
metadata:
|
|
176
|
+
bug_tracker_uri: https://github.com/socketry/async/issues
|
|
177
|
+
changelog_uri: https://github.com/socketry/async/blob/main/releases.md
|
|
176
178
|
documentation_uri: https://socketry.github.io/async/
|
|
177
179
|
funding_uri: https://github.com/sponsors/ioquatix/
|
|
178
180
|
source_code_uri: https://github.com/socketry/async.git
|
metadata.gz.sig
CHANGED
|
Binary file
|