async 2.17.0 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a017a6f3304bf910379aeb0f16a40daa7fce7a3de0a3e56c97a359879a3910d1
4
- data.tar.gz: '09a048a8b24b6779d23540f85ba8e5a1d6317d9cfc87f91e74af22960a21fd29'
3
+ metadata.gz: 6a94e07aa32d09643fca9fcdb1abed3ea1cc266561331b42f840b39cdb391673
4
+ data.tar.gz: ed364eb2cf2676401edc7a2d35eaab0f9f38e89aed1c66a1b03a0ae5e97a4441
5
5
  SHA512:
6
- metadata.gz: 415e7d9d23c06c60c752bb5b1ecbc336a98bd14b01b33c08bac56e4b8062b6b64761f4fcd8a412455705fb3908b715630beda5eaec7b62e3569e33cb37d235ea
7
- data.tar.gz: 8f31cdb2fa5aded62f174683f7a5c62589191bd9263fc9c1d07c78c319592d47f4d3eb46cf92ac0f3005dad219756d16961a6a93823564de1e0263c4f1e70cb3
6
+ metadata.gz: 353f270a396696c8a689e5e48657a0c06efb21a6a5d6ade30c68c54b7bd09c7b123466b6a382237deffa6f15ce186ececcf49b52d814cafff7bd4c446db3910c
7
+ data.tar.gz: 7390bd9fbef443a145dbbfd17f593cb0dffd91021ecb38cd3441a4a6ac7c04394197b512f177595739608a498f54c5619e14fd23ce0c0100a7b45eaa9b0bb3a6
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/async/barrier.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2022, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'list'
7
- require_relative 'task'
6
+ require_relative "list"
7
+ require_relative "task"
8
8
 
9
9
  module Async
10
10
  # A general purpose synchronisation primitive, which allows one task to wait for a number of other tasks to complete. It can be used in conjunction with {Semaphore}.
@@ -4,8 +4,8 @@
4
4
  # Copyright, 2017-2024, by Samuel Williams.
5
5
  # Copyright, 2017, by Kent Gruber.
6
6
 
7
- require 'fiber'
8
- require_relative 'list'
7
+ require "fiber"
8
+ require_relative "list"
9
9
 
10
10
  module Async
11
11
  # A synchronization primitive, which allows fibers to wait until a particular condition is (edge) triggered.
data/lib/async/node.rb CHANGED
@@ -5,9 +5,9 @@
5
5
  # Copyright, 2017, by Kent Gruber.
6
6
  # Copyright, 2022, by Shannon Skipper.
7
7
 
8
- require 'fiber/annotation'
8
+ require "fiber/annotation"
9
9
 
10
- require_relative 'list'
10
+ require_relative "list"
11
11
 
12
12
  module Async
13
13
  # A list of children tasks.
@@ -3,7 +3,7 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2018-2024, by Samuel Williams.
5
5
 
6
- require_relative 'condition'
6
+ require_relative "condition"
7
7
 
8
8
  module Async
9
9
  # A synchronization primitive, which allows fibers to wait until a notification is received. Does not block the task which signals the notification. Waiting tasks are resumed on next iteration of the reactor.
data/lib/async/queue.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # Copyright, 2019, by Ryan Musgrave.
6
6
  # Copyright, 2020-2022, by Bruno Sutic.
7
7
 
8
- require_relative 'notification'
8
+ require_relative "notification"
9
9
 
10
10
  module Async
11
11
  # A queue which allows items to be processed in order.
@@ -88,7 +88,7 @@ module Async
88
88
  end
89
89
 
90
90
  # Signal the queue with a value, the same as {#enqueue}.
91
- def signal(value)
91
+ def signal(value = nil)
92
92
  self.enqueue(value)
93
93
  end
94
94
 
data/lib/async/reactor.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # Copyright, 2017, by Kent Gruber.
6
6
  # Copyright, 2018, by Sokolov Yura.
7
7
 
8
- require_relative 'scheduler'
8
+ require_relative "scheduler"
9
9
 
10
10
  module Async
11
11
  # A wrapper around the the scheduler which binds it to the current thread automatically.
@@ -5,13 +5,13 @@
5
5
  # Copyright, 2020, by Jun Jiang.
6
6
  # Copyright, 2021, by Julien Portalier.
7
7
 
8
- require_relative 'clock'
9
- require_relative 'task'
8
+ require_relative "clock"
9
+ require_relative "task"
10
10
 
11
- require 'io/event'
11
+ require "io/event"
12
12
 
13
- require 'console'
14
- require 'resolv'
13
+ require "console"
14
+ require "resolv"
15
15
 
16
16
  module Async
17
17
  # Handles scheduling of fibers. Implements the fiber scheduler interface.
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2023, by Samuel Williams.
4
+ # Copyright, 2018-2024, by Samuel Williams.
5
5
 
6
- require_relative 'list'
6
+ require_relative "list"
7
7
 
8
8
  module Async
9
9
  # A synchronization primitive, which limits access to a given resource.
data/lib/async/task.rb CHANGED
@@ -7,11 +7,11 @@
7
7
  # Copyright, 2020, by Patrik Wenger.
8
8
  # Copyright, 2023, by Math Ieu.
9
9
 
10
- require 'fiber'
11
- require 'console/event/failure'
10
+ require "fiber"
11
+ require "console/event/failure"
12
12
 
13
- require_relative 'node'
14
- require_relative 'condition'
13
+ require_relative "node"
14
+ require_relative "condition"
15
15
 
16
16
  Fiber.attr_accessor :async_task
17
17
 
@@ -3,7 +3,7 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2021-2024, by Samuel Williams.
5
5
 
6
- require_relative 'condition'
6
+ require_relative "condition"
7
7
 
8
8
  module Async
9
9
  # A synchronization primitive that allows one task to wait for another task to resolve a value.
data/lib/async/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2017-2024, by Samuel Williams.
5
5
 
6
6
  module Async
7
- VERSION = "2.17.0"
7
+ VERSION = "2.18.0"
8
8
  end
data/lib/kernel/sync.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2019-2024, by Samuel Williams.
5
5
  # Copyright, 2020, by Brian Morearty.
6
+ # Copyright, 2024, by Patrik Wenger.
6
7
 
7
8
  require_relative "../async/reactor"
8
9
 
@@ -15,9 +16,13 @@ module Kernel
15
16
  #
16
17
  # @public Since `stable-v1`.
17
18
  # @asynchronous Will block until given block completes executing.
18
- def Sync(&block)
19
+ def Sync(annotation: nil, &block)
19
20
  if task = ::Async::Task.current?
20
- yield task
21
+ if annotation
22
+ task.annotate(annotation) {yield task}
23
+ else
24
+ yield task
25
+ end
21
26
  elsif scheduler = Fiber.scheduler
22
27
  ::Async::Task.run(scheduler, &block).wait
23
28
  else
@@ -25,7 +30,7 @@ module Kernel
25
30
  reactor = Async::Reactor.new
26
31
 
27
32
  begin
28
- return reactor.run(finished: ::Async::Condition.new, &block).wait
33
+ return reactor.run(annotation: annotation, finished: ::Async::Condition.new, &block).wait
29
34
  ensure
30
35
  Fiber.set_scheduler(nil)
31
36
  end
data/readme.md CHANGED
@@ -35,8 +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.18.0
39
+
40
+ - Add support for `Sync(annotation:)`, so that you can annotate the block with a description of what it does, even if it doesn't create a new task.
41
+
38
42
  ### v2.17.0
39
43
 
44
+ - Introduce `Async::Queue#push` and `Async::Queue#pop` for compatibility with `::Queue`.
45
+
40
46
  ### v2.16.0
41
47
 
42
48
  - [Better Handling of Async and Sync in Nested Fibers](https://socketry.github.io/async/releases/index#better-handling-of-async-and-sync-in-nested-fibers)
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v2.18.0
4
+
5
+ - Add support for `Sync(annotation:)`, so that you can annotate the block with a description of what it does, even if it doesn't create a new task.
6
+
3
7
  ## v2.17.0
4
8
 
5
9
  - Introduce `Async::Queue#push` and `Async::Queue#pop` for compatibility with `::Queue`.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.17.0
4
+ version: 2.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - Bruno Sutic
9
9
  - Jeremy Jung
10
10
  - Olle Jonsson
11
- - Devin Christensen
12
11
  - Patrik Wenger
12
+ - Devin Christensen
13
13
  - Emil Tin
14
14
  - Jamie McCarthy
15
15
  - Kent Gruber
@@ -63,7 +63,7 @@ cert_chain:
63
63
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
64
64
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
65
65
  -----END CERTIFICATE-----
66
- date: 2024-09-05 00:00:00.000000000 Z
66
+ date: 2024-10-29 00:00:00.000000000 Z
67
67
  dependencies:
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: console
@@ -161,14 +161,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
161
  requirements:
162
162
  - - ">="
163
163
  - !ruby/object:Gem::Version
164
- version: 3.1.1
164
+ version: '3.1'
165
165
  required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  requirements:
167
167
  - - ">="
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  requirements: []
171
- rubygems_version: 3.5.11
171
+ rubygems_version: 3.3.8
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: A concurrency framework for Ruby.
metadata.gz.sig CHANGED
Binary file