async 1.28.2 → 1.28.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/async/reactor.rb +4 -4
- data/lib/async/scheduler.rb +10 -12
- data/lib/async/task.rb +2 -2
- data/lib/async/version.rb +1 -1
- data/lib/kernel/sync.rb +4 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b128ca85a69e6f07c87da25bc6c138a1198141cb01b02200ede0a677313a98dc
|
4
|
+
data.tar.gz: d9b0bae05938d165d08e6812fe9c08a8908cbae4826945a69b70b62cfee81059
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a600ab32546c19049ba04a6ada9637db0e8c128d70e259a994da70a6e00e4fdc70a4a7de91e2149ded2cb1738d8f07a2cb8cdab79d06927cbd78d895e1d3bf9
|
7
|
+
data.tar.gz: 2a90f534c8d0ff01b2bff0a23fea131b24affae3a1c239f3d7bde17beadfb7ba462528d0de2f23b54cf1d564fd3622dd8a24462a7328690234ba3a3286692d9d
|
data/lib/async/reactor.rb
CHANGED
@@ -102,7 +102,7 @@ module Async
|
|
102
102
|
fiber = Fiber.current
|
103
103
|
|
104
104
|
if timeout
|
105
|
-
timer =
|
105
|
+
timer = @timers.after(timeout) do
|
106
106
|
if fiber.alive?
|
107
107
|
fiber.resume(false)
|
108
108
|
end
|
@@ -111,7 +111,7 @@ module Async
|
|
111
111
|
|
112
112
|
begin
|
113
113
|
@blocked += 1
|
114
|
-
|
114
|
+
Task.yield
|
115
115
|
ensure
|
116
116
|
@blocked -= 1
|
117
117
|
end
|
@@ -198,7 +198,7 @@ module Async
|
|
198
198
|
def yield(fiber = Fiber.current)
|
199
199
|
@ready << fiber
|
200
200
|
|
201
|
-
|
201
|
+
Task.yield
|
202
202
|
end
|
203
203
|
|
204
204
|
def finished?
|
@@ -223,7 +223,7 @@ module Async
|
|
223
223
|
@running.clear
|
224
224
|
end
|
225
225
|
|
226
|
-
|
226
|
+
if @unblocked.any?
|
227
227
|
unblocked = Array.new
|
228
228
|
|
229
229
|
@guard.synchronize do
|
data/lib/async/scheduler.rb
CHANGED
@@ -34,24 +34,20 @@ module Async
|
|
34
34
|
|
35
35
|
def initialize(reactor)
|
36
36
|
@reactor = reactor
|
37
|
-
@wrappers = nil
|
38
37
|
end
|
39
38
|
|
39
|
+
attr :wrappers
|
40
|
+
|
40
41
|
def set!
|
41
|
-
@wrappers = {}
|
42
42
|
Fiber.set_scheduler(self)
|
43
43
|
end
|
44
44
|
|
45
45
|
def clear!
|
46
|
-
# Because these instances are created with `autoclose: false`, this does not close the underlying file descriptor:
|
47
|
-
# @ios&.each_value(&:close)
|
48
|
-
|
49
|
-
@wrappers = nil
|
50
46
|
Fiber.set_scheduler(nil)
|
51
47
|
end
|
52
48
|
|
53
49
|
private def from_io(io)
|
54
|
-
|
50
|
+
Wrapper.new(io, @reactor)
|
55
51
|
end
|
56
52
|
|
57
53
|
def io_wait(io, events, timeout = nil)
|
@@ -82,12 +78,12 @@ module Async
|
|
82
78
|
# @returns [Process::Status] A process status instance.
|
83
79
|
def process_wait(pid, flags)
|
84
80
|
Thread.new do
|
85
|
-
Process::Status.wait(pid, flags)
|
81
|
+
::Process::Status.wait(pid, flags)
|
86
82
|
end.value
|
87
83
|
end
|
88
84
|
|
89
85
|
def kernel_sleep(duration)
|
90
|
-
|
86
|
+
self.block(nil, duration)
|
91
87
|
end
|
92
88
|
|
93
89
|
def block(blocker, timeout)
|
@@ -102,11 +98,13 @@ module Async
|
|
102
98
|
end
|
103
99
|
|
104
100
|
def fiber(&block)
|
105
|
-
task = Task.new(&block)
|
101
|
+
task = Task.new(@reactor, &block)
|
102
|
+
|
103
|
+
fiber = task.fiber
|
106
104
|
|
107
|
-
task.
|
105
|
+
task.run
|
108
106
|
|
109
|
-
return
|
107
|
+
return fiber
|
110
108
|
end
|
111
109
|
end
|
112
110
|
end
|
data/lib/async/task.rb
CHANGED
@@ -72,14 +72,14 @@ module Async
|
|
72
72
|
# Create a new task.
|
73
73
|
# @param reactor [Async::Reactor] the reactor this task will run within.
|
74
74
|
# @param parent [Async::Task] the parent task.
|
75
|
-
def initialize(reactor, parent = Task.current?, logger: nil, **options, &block)
|
75
|
+
def initialize(reactor, parent = Task.current?, logger: nil, finished: nil, **options, &block)
|
76
76
|
super(parent || reactor, **options)
|
77
77
|
|
78
78
|
@reactor = reactor
|
79
79
|
|
80
80
|
@status = :initialized
|
81
81
|
@result = nil
|
82
|
-
@finished =
|
82
|
+
@finished = finished
|
83
83
|
|
84
84
|
@logger = logger
|
85
85
|
|
data/lib/async/version.rb
CHANGED
data/lib/kernel/sync.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.28.
|
4
|
+
version: 1.28.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: console
|