polyphony 0.71 → 0.74
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/test.yml +15 -11
- data/.github/workflows/test_io_uring.yml +32 -0
- data/.gitignore +3 -1
- data/CHANGELOG.md +33 -4
- data/Gemfile.lock +16 -13
- data/TODO.md +1 -1
- data/bin/pdbg +1 -1
- data/docs/_user-guide/all-about-timers.md +1 -1
- data/docs/api-reference/exception.md +5 -1
- data/docs/api-reference/fiber.md +2 -2
- data/docs/faq.md +1 -1
- data/docs/getting-started/overview.md +8 -8
- data/docs/getting-started/tutorial.md +3 -3
- data/docs/main-concepts/concurrency.md +1 -1
- data/docs/main-concepts/extending.md +3 -3
- data/docs/main-concepts/fiber-scheduling.md +1 -1
- data/examples/core/calc.rb +37 -0
- data/examples/core/calc_with_restart.rb +40 -0
- data/examples/core/calc_with_supervise.rb +37 -0
- data/examples/core/message_based_supervision.rb +1 -1
- data/examples/core/ring.rb +29 -0
- data/examples/io/rack_server.rb +1 -1
- data/examples/io/tunnel.rb +1 -1
- data/examples/performance/fiber_transfer.rb +1 -1
- data/examples/performance/line_splitting.rb +1 -1
- data/examples/performance/thread-vs-fiber/compare.rb +1 -1
- data/ext/polyphony/backend_common.c +88 -18
- data/ext/polyphony/backend_common.h +8 -1
- data/ext/polyphony/backend_io_uring.c +280 -164
- data/ext/polyphony/backend_io_uring_context.c +2 -1
- data/ext/polyphony/backend_io_uring_context.h +3 -2
- data/ext/polyphony/backend_libev.c +42 -38
- data/ext/polyphony/event.c +5 -2
- data/ext/polyphony/extconf.rb +25 -13
- data/ext/polyphony/polyphony.c +10 -1
- data/ext/polyphony/polyphony.h +7 -1
- data/ext/polyphony/queue.c +12 -7
- data/ext/polyphony/runqueue_ring_buffer.c +6 -3
- data/ext/polyphony/socket_extensions.c +5 -2
- data/ext/polyphony/thread.c +1 -1
- data/lib/polyphony/adapters/irb.rb +11 -1
- data/lib/polyphony/{extensions → core}/debug.rb +0 -0
- data/lib/polyphony/core/global_api.rb +3 -6
- data/lib/polyphony/core/timer.rb +2 -2
- data/lib/polyphony/debugger.rb +3 -3
- data/lib/polyphony/extensions/exception.rb +45 -0
- data/lib/polyphony/extensions/fiber.rb +87 -11
- data/lib/polyphony/extensions/io.rb +2 -2
- data/lib/polyphony/extensions/{core.rb → kernel.rb} +0 -73
- data/lib/polyphony/extensions/openssl.rb +20 -5
- data/lib/polyphony/extensions/process.rb +19 -0
- data/lib/polyphony/extensions/socket.rb +20 -9
- data/lib/polyphony/extensions/thread.rb +9 -3
- data/lib/polyphony/extensions/timeout.rb +10 -0
- data/lib/polyphony/extensions.rb +9 -0
- data/lib/polyphony/version.rb +1 -1
- data/lib/polyphony.rb +2 -4
- data/polyphony.gemspec +1 -1
- data/test/coverage.rb +2 -2
- data/test/test_backend.rb +15 -17
- data/test/test_event.rb +1 -1
- data/test/test_ext.rb +1 -1
- data/test/test_fiber.rb +31 -7
- data/test/test_global_api.rb +23 -14
- data/test/test_io.rb +5 -5
- data/test/test_kernel.rb +2 -2
- data/test/test_process_supervision.rb +1 -1
- data/test/test_queue.rb +6 -6
- data/test/test_signal.rb +20 -1
- data/test/test_socket.rb +45 -10
- data/test/test_supervise.rb +85 -0
- data/test/test_sync.rb +2 -2
- data/test/test_thread.rb +22 -2
- data/test/test_thread_pool.rb +2 -2
- data/test/test_throttler.rb +3 -3
- data/test/test_timer.rb +3 -3
- data/test/test_trace.rb +1 -1
- metadata +19 -9
data/test/test_thread_pool.rb
CHANGED
@@ -65,9 +65,9 @@ class ThreadPoolTest < MiniTest::Test
|
|
65
65
|
end
|
66
66
|
elapsed = Time.now - t0
|
67
67
|
|
68
|
-
assert_in_range 0.0..0.009, elapsed
|
68
|
+
assert_in_range 0.0..0.009, elapsed if IS_LINUX
|
69
69
|
assert buffer.size < 2
|
70
|
-
|
70
|
+
|
71
71
|
sleep 0.15 # allow time for threads to spawn
|
72
72
|
assert_equal @pool.size, threads.uniq.size
|
73
73
|
assert_equal (0..9).to_a, buffer.sort if IS_LINUX
|
data/test/test_throttler.rb
CHANGED
@@ -10,7 +10,7 @@ class ThrottlerTest < MiniTest::Test
|
|
10
10
|
f = spin { loop { t.process { buffer << 1 } } }
|
11
11
|
sleep 0.2
|
12
12
|
f.stop
|
13
|
-
assert_in_range 1..4, buffer.size
|
13
|
+
assert_in_range 1..4, buffer.size if IS_LINUX
|
14
14
|
ensure
|
15
15
|
t.stop
|
16
16
|
end
|
@@ -23,7 +23,7 @@ class ThrottlerTest < MiniTest::Test
|
|
23
23
|
end
|
24
24
|
sleep 0.25
|
25
25
|
f.stop
|
26
|
-
assert_in_range
|
26
|
+
assert_in_range 4..6, buffer.size if IS_LINUX
|
27
27
|
ensure
|
28
28
|
t.stop
|
29
29
|
end
|
@@ -34,7 +34,7 @@ class ThrottlerTest < MiniTest::Test
|
|
34
34
|
f = spin { loop { t.process { buffer << 1 } } }
|
35
35
|
sleep 0.02
|
36
36
|
f.stop
|
37
|
-
assert_in_range 2..
|
37
|
+
assert_in_range 2..4, buffer.size if IS_LINUX
|
38
38
|
ensure
|
39
39
|
t.stop
|
40
40
|
end
|
data/test/test_timer.rb
CHANGED
@@ -137,11 +137,11 @@ class TimerMiscTest < MiniTest::Test
|
|
137
137
|
@timer = Polyphony::Timer.new(resolution: 0.001)
|
138
138
|
sleep 0
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
def teardown
|
142
142
|
@timer.stop
|
143
143
|
end
|
144
|
-
|
144
|
+
|
145
145
|
def test_timer_after
|
146
146
|
buffer = []
|
147
147
|
f = @timer.after(0.01) { buffer << 2 }
|
@@ -160,6 +160,6 @@ class TimerMiscTest < MiniTest::Test
|
|
160
160
|
end
|
161
161
|
sleep 0.05
|
162
162
|
f.stop
|
163
|
-
assert_in_range 3..7, buffer.size
|
163
|
+
assert_in_range 3..7, buffer.size if IS_LINUX
|
164
164
|
end
|
165
165
|
end
|
data/test/test_trace.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyphony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.74'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sharon Rosner
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 1.1.4
|
139
|
-
description:
|
139
|
+
description:
|
140
140
|
email: sharon@noteflakes.com
|
141
141
|
executables: []
|
142
142
|
extensions:
|
@@ -144,7 +144,9 @@ extensions:
|
|
144
144
|
extra_rdoc_files:
|
145
145
|
- README.md
|
146
146
|
files:
|
147
|
+
- ".github/FUNDING.yml"
|
147
148
|
- ".github/workflows/test.yml"
|
149
|
+
- ".github/workflows/test_io_uring.yml"
|
148
150
|
- ".gitignore"
|
149
151
|
- ".gitmodules"
|
150
152
|
- ".rubocop.yml"
|
@@ -215,6 +217,9 @@ files:
|
|
215
217
|
- examples/adapters/sequel_mysql_pool.rb
|
216
218
|
- examples/adapters/sequel_pg.rb
|
217
219
|
- examples/core/await.rb
|
220
|
+
- examples/core/calc.rb
|
221
|
+
- examples/core/calc_with_restart.rb
|
222
|
+
- examples/core/calc_with_supervise.rb
|
218
223
|
- examples/core/channels.rb
|
219
224
|
- examples/core/deferring-an-operation.rb
|
220
225
|
- examples/core/enumerable.rb
|
@@ -229,6 +234,7 @@ files:
|
|
229
234
|
- examples/core/queue.rb
|
230
235
|
- examples/core/recurrent-timer.rb
|
231
236
|
- examples/core/resource_delegate.rb
|
237
|
+
- examples/core/ring.rb
|
232
238
|
- examples/core/spin.rb
|
233
239
|
- examples/core/spin_error_backtrace.rb
|
234
240
|
- examples/core/supervise-process.rb
|
@@ -350,6 +356,7 @@ files:
|
|
350
356
|
- lib/polyphony/adapters/redis.rb
|
351
357
|
- lib/polyphony/adapters/sequel.rb
|
352
358
|
- lib/polyphony/core/channel.rb
|
359
|
+
- lib/polyphony/core/debug.rb
|
353
360
|
- lib/polyphony/core/exceptions.rb
|
354
361
|
- lib/polyphony/core/global_api.rb
|
355
362
|
- lib/polyphony/core/resource_pool.rb
|
@@ -358,13 +365,16 @@ files:
|
|
358
365
|
- lib/polyphony/core/throttler.rb
|
359
366
|
- lib/polyphony/core/timer.rb
|
360
367
|
- lib/polyphony/debugger.rb
|
361
|
-
- lib/polyphony/extensions
|
362
|
-
- lib/polyphony/extensions/
|
368
|
+
- lib/polyphony/extensions.rb
|
369
|
+
- lib/polyphony/extensions/exception.rb
|
363
370
|
- lib/polyphony/extensions/fiber.rb
|
364
371
|
- lib/polyphony/extensions/io.rb
|
372
|
+
- lib/polyphony/extensions/kernel.rb
|
365
373
|
- lib/polyphony/extensions/openssl.rb
|
374
|
+
- lib/polyphony/extensions/process.rb
|
366
375
|
- lib/polyphony/extensions/socket.rb
|
367
376
|
- lib/polyphony/extensions/thread.rb
|
377
|
+
- lib/polyphony/extensions/timeout.rb
|
368
378
|
- lib/polyphony/net.rb
|
369
379
|
- lib/polyphony/version.rb
|
370
380
|
- polyphony.gemspec
|
@@ -402,7 +412,7 @@ metadata:
|
|
402
412
|
documentation_uri: https://digital-fabric.github.io/polyphony/
|
403
413
|
homepage_uri: https://digital-fabric.github.io/polyphony/
|
404
414
|
changelog_uri: https://github.com/digital-fabric/polyphony/blob/master/CHANGELOG.md
|
405
|
-
post_install_message:
|
415
|
+
post_install_message:
|
406
416
|
rdoc_options:
|
407
417
|
- "--title"
|
408
418
|
- polyphony
|
@@ -421,8 +431,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
421
431
|
- !ruby/object:Gem::Version
|
422
432
|
version: '0'
|
423
433
|
requirements: []
|
424
|
-
rubygems_version: 3.
|
425
|
-
signing_key:
|
434
|
+
rubygems_version: 3.3.3
|
435
|
+
signing_key:
|
426
436
|
specification_version: 4
|
427
437
|
summary: Fine grained concurrency for Ruby
|
428
438
|
test_files: []
|