polyphony 0.46.0 → 0.47.3
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
- data/CHANGELOG.md +24 -0
- data/Gemfile.lock +1 -1
- data/TODO.md +54 -23
- data/bin/test +4 -0
- data/examples/core/enumerable.rb +64 -0
- data/examples/performance/fiber_resume.rb +43 -0
- data/examples/performance/fiber_transfer.rb +13 -4
- data/examples/performance/thread-vs-fiber/compare.rb +59 -0
- data/examples/performance/thread-vs-fiber/em_server.rb +33 -0
- data/examples/performance/thread-vs-fiber/polyphony_server.rb +9 -19
- data/examples/performance/thread-vs-fiber/threaded_server.rb +22 -15
- data/examples/performance/thread_switch.rb +44 -0
- data/ext/polyphony/backend_common.h +20 -0
- data/ext/polyphony/backend_io_uring.c +127 -16
- data/ext/polyphony/backend_io_uring_context.c +1 -0
- data/ext/polyphony/backend_io_uring_context.h +1 -0
- data/ext/polyphony/backend_libev.c +102 -0
- data/ext/polyphony/fiber.c +11 -7
- data/ext/polyphony/polyphony.c +3 -0
- data/ext/polyphony/polyphony.h +7 -7
- data/ext/polyphony/queue.c +99 -34
- data/ext/polyphony/thread.c +1 -3
- data/lib/polyphony/core/exceptions.rb +0 -4
- data/lib/polyphony/core/global_api.rb +49 -31
- data/lib/polyphony/extensions/core.rb +9 -15
- data/lib/polyphony/extensions/fiber.rb +8 -2
- data/lib/polyphony/extensions/openssl.rb +6 -0
- data/lib/polyphony/extensions/socket.rb +18 -4
- data/lib/polyphony/version.rb +1 -1
- data/test/helper.rb +1 -1
- data/test/stress.rb +1 -1
- data/test/test_backend.rb +59 -0
- data/test/test_fiber.rb +33 -4
- data/test/test_global_api.rb +85 -1
- data/test/test_queue.rb +117 -0
- data/test/test_signal.rb +18 -0
- data/test/test_socket.rb +2 -2
- metadata +8 -2
data/test/test_signal.rb
CHANGED
@@ -76,4 +76,22 @@ class SignalTrapTest < Minitest::Test
|
|
76
76
|
buffer = i.read
|
77
77
|
assert_equal "3-interrupt\n", buffer
|
78
78
|
end
|
79
|
+
|
80
|
+
def test_io_in_signal_handler
|
81
|
+
i, o = IO.pipe
|
82
|
+
pid = Polyphony.fork do
|
83
|
+
trap('INT') { o.puts 'INT'; o.close; exit! }
|
84
|
+
i.close
|
85
|
+
sleep
|
86
|
+
ensure
|
87
|
+
o.close
|
88
|
+
end
|
89
|
+
|
90
|
+
o.close
|
91
|
+
sleep 0.1
|
92
|
+
Process.kill('INT', pid)
|
93
|
+
Thread.current.backend.waitpid(pid)
|
94
|
+
buffer = i.read
|
95
|
+
assert_equal "INT\n", buffer
|
96
|
+
end
|
79
97
|
end
|
data/test/test_socket.rb
CHANGED
@@ -40,12 +40,12 @@ class HTTPClientTest < MiniTest::Test
|
|
40
40
|
def test_http
|
41
41
|
res = HTTParty.get('http://worldtimeapi.org/api/timezone/Europe/Paris')
|
42
42
|
response = JSON.load(res.body)
|
43
|
-
assert_equal "
|
43
|
+
assert_equal "CET", response['abbreviation']
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_https
|
47
47
|
res = HTTParty.get('https://worldtimeapi.org/api/timezone/Europe/Paris')
|
48
48
|
response = JSON.load(res.body)
|
49
|
-
assert_equal "
|
49
|
+
assert_equal "CET", response['abbreviation']
|
50
50
|
end
|
51
51
|
end
|
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.47.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sharon Rosner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -290,6 +290,7 @@ files:
|
|
290
290
|
- TODO.md
|
291
291
|
- bin/polyphony-debug
|
292
292
|
- bin/stress.rb
|
293
|
+
- bin/test
|
293
294
|
- docs/_config.yml
|
294
295
|
- docs/_includes/head.html
|
295
296
|
- docs/_includes/title.html
|
@@ -347,6 +348,7 @@ files:
|
|
347
348
|
- examples/core/await.rb
|
348
349
|
- examples/core/channels.rb
|
349
350
|
- examples/core/deferring-an-operation.rb
|
351
|
+
- examples/core/enumerable.rb
|
350
352
|
- examples/core/erlang-style-genserver.rb
|
351
353
|
- examples/core/forking.rb
|
352
354
|
- examples/core/handling-signals.rb
|
@@ -385,6 +387,7 @@ files:
|
|
385
387
|
- examples/io/tcpsocket.rb
|
386
388
|
- examples/io/tunnel.rb
|
387
389
|
- examples/io/zip.rb
|
390
|
+
- examples/performance/fiber_resume.rb
|
388
391
|
- examples/performance/fiber_transfer.rb
|
389
392
|
- examples/performance/fs_read.rb
|
390
393
|
- examples/performance/mem-usage.rb
|
@@ -393,6 +396,8 @@ files:
|
|
393
396
|
- examples/performance/snooze.rb
|
394
397
|
- examples/performance/snooze_raw.rb
|
395
398
|
- examples/performance/switch.rb
|
399
|
+
- examples/performance/thread-vs-fiber/compare.rb
|
400
|
+
- examples/performance/thread-vs-fiber/em_server.rb
|
396
401
|
- examples/performance/thread-vs-fiber/httparty_multi.rb
|
397
402
|
- examples/performance/thread-vs-fiber/httparty_threaded.rb
|
398
403
|
- examples/performance/thread-vs-fiber/polyphony_mt_server.rb
|
@@ -400,6 +405,7 @@ files:
|
|
400
405
|
- examples/performance/thread-vs-fiber/polyphony_server_read_loop.rb
|
401
406
|
- examples/performance/thread-vs-fiber/threaded_server.rb
|
402
407
|
- examples/performance/thread_pool_perf.rb
|
408
|
+
- examples/performance/thread_switch.rb
|
403
409
|
- ext/libev/Changes
|
404
410
|
- ext/libev/LICENSE
|
405
411
|
- ext/libev/README
|