polyphony 0.40 → 0.43.2
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/.github/workflows/test.yml +11 -2
- data/.gitignore +2 -2
- data/.rubocop.yml +30 -0
- data/CHANGELOG.md +29 -2
- data/Gemfile.lock +13 -10
- data/README.md +0 -1
- data/Rakefile +3 -3
- data/TODO.md +27 -97
- data/docs/_config.yml +56 -7
- data/docs/_sass/custom/custom.scss +6 -26
- data/docs/_sass/overrides.scss +0 -46
- data/docs/{user-guide → _user-guide}/all-about-timers.md +0 -0
- data/docs/_user-guide/index.md +9 -0
- data/docs/{user-guide → _user-guide}/web-server.md +0 -0
- data/docs/api-reference/fiber.md +2 -2
- data/docs/api-reference/index.md +9 -0
- data/docs/api-reference/polyphony-process.md +1 -1
- data/docs/api-reference/thread.md +1 -1
- data/docs/faq.md +21 -11
- data/docs/favicon.ico +0 -0
- data/docs/getting-started/index.md +10 -0
- data/docs/getting-started/installing.md +2 -6
- data/docs/getting-started/overview.md +486 -0
- data/docs/getting-started/tutorial.md +27 -19
- data/docs/index.md +6 -2
- data/docs/main-concepts/concurrency.md +0 -5
- data/docs/main-concepts/design-principles.md +69 -21
- data/docs/main-concepts/extending.md +1 -1
- data/docs/main-concepts/index.md +9 -0
- data/docs/polyphony-logo.png +0 -0
- data/examples/adapters/redis_blpop.rb +12 -0
- data/examples/core/01-spinning-up-fibers.rb +1 -0
- data/examples/core/03-interrupting.rb +4 -1
- data/examples/core/04-handling-signals.rb +19 -0
- data/examples/core/xx-agent.rb +102 -0
- data/examples/core/xx-sleeping.rb +14 -6
- data/examples/io/xx-irb.rb +1 -1
- data/examples/performance/thread-vs-fiber/polyphony_mt_server.rb +7 -6
- data/examples/performance/thread-vs-fiber/polyphony_server.rb +13 -36
- data/examples/performance/thread-vs-fiber/polyphony_server_read_loop.rb +58 -0
- data/examples/performance/xx-array.rb +11 -0
- data/examples/performance/xx-fiber-switch.rb +9 -0
- data/examples/performance/xx-snooze.rb +15 -0
- data/ext/{gyro → polyphony}/extconf.rb +2 -2
- data/ext/{gyro → polyphony}/fiber.c +15 -22
- data/ext/{gyro → polyphony}/libev.c +0 -0
- data/ext/{gyro → polyphony}/libev.h +0 -0
- data/ext/polyphony/libev_agent.c +725 -0
- data/ext/polyphony/libev_queue.c +217 -0
- data/ext/{gyro/gyro.c → polyphony/polyphony.c} +12 -37
- data/ext/polyphony/polyphony.h +90 -0
- data/ext/polyphony/polyphony_ext.c +21 -0
- data/ext/{gyro → polyphony}/thread.c +34 -151
- data/ext/{gyro → polyphony}/tracing.c +1 -1
- data/lib/polyphony.rb +19 -12
- data/lib/polyphony/adapters/irb.rb +1 -1
- data/lib/polyphony/adapters/postgres.rb +6 -5
- data/lib/polyphony/adapters/process.rb +5 -5
- data/lib/polyphony/adapters/redis.rb +3 -2
- data/lib/polyphony/adapters/trace.rb +28 -28
- data/lib/polyphony/core/channel.rb +3 -3
- data/lib/polyphony/core/exceptions.rb +1 -1
- data/lib/polyphony/core/global_api.rb +13 -11
- data/lib/polyphony/core/resource_pool.rb +3 -3
- data/lib/polyphony/core/sync.rb +2 -2
- data/lib/polyphony/core/thread_pool.rb +6 -6
- data/lib/polyphony/core/throttler.rb +13 -6
- data/lib/polyphony/event.rb +27 -0
- data/lib/polyphony/extensions/core.rb +22 -14
- data/lib/polyphony/extensions/fiber.rb +4 -4
- data/lib/polyphony/extensions/io.rb +59 -25
- data/lib/polyphony/extensions/openssl.rb +36 -16
- data/lib/polyphony/extensions/socket.rb +28 -10
- data/lib/polyphony/extensions/thread.rb +16 -9
- data/lib/polyphony/net.rb +9 -9
- data/lib/polyphony/version.rb +1 -1
- data/polyphony.gemspec +3 -3
- data/test/helper.rb +12 -1
- data/test/test_agent.rb +130 -0
- data/test/{test_async.rb → test_event.rb} +13 -7
- data/test/test_ext.rb +25 -4
- data/test/test_fiber.rb +19 -10
- data/test/test_global_api.rb +6 -6
- data/test/test_io.rb +46 -24
- data/test/test_queue.rb +74 -0
- data/test/test_signal.rb +3 -40
- data/test/test_socket.rb +34 -0
- data/test/test_thread.rb +37 -16
- data/test/test_trace.rb +6 -5
- metadata +39 -41
- data/docs/_includes/nav.html +0 -51
- data/docs/_includes/prevnext.html +0 -17
- data/docs/_layouts/default.html +0 -106
- data/docs/api-reference.md +0 -11
- data/docs/api-reference/gyro-async.md +0 -57
- data/docs/api-reference/gyro-child.md +0 -29
- data/docs/api-reference/gyro-queue.md +0 -44
- data/docs/api-reference/gyro-timer.md +0 -51
- data/docs/api-reference/gyro.md +0 -25
- data/docs/getting-started.md +0 -10
- data/docs/main-concepts.md +0 -10
- data/docs/user-guide.md +0 -10
- data/examples/core/forever_sleep.rb +0 -19
- data/ext/gyro/async.c +0 -132
- data/ext/gyro/child.c +0 -108
- data/ext/gyro/gyro.h +0 -158
- data/ext/gyro/gyro_ext.c +0 -33
- data/ext/gyro/io.c +0 -457
- data/ext/gyro/queue.c +0 -146
- data/ext/gyro/selector.c +0 -205
- data/ext/gyro/signal.c +0 -99
- data/ext/gyro/socket.c +0 -213
- data/ext/gyro/timer.c +0 -115
- data/test/test_timer.rb +0 -56
data/test/test_trace.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'helper'
|
4
|
+
require 'polyphony/adapters/trace'
|
4
5
|
|
5
6
|
class TraceTest < MiniTest::Test
|
6
7
|
def test_tracing_disabled
|
@@ -11,13 +12,13 @@ class TraceTest < MiniTest::Test
|
|
11
12
|
assert_equal 0, records.size
|
12
13
|
ensure
|
13
14
|
t&.disable
|
14
|
-
|
15
|
+
Polyphony.trace(nil)
|
15
16
|
end
|
16
17
|
|
17
18
|
def test_tracing_enabled
|
18
19
|
records = []
|
19
20
|
t = Polyphony::Trace.new(:fiber_all) { |r| records << r if r[:event] =~ /^fiber_/ }
|
20
|
-
|
21
|
+
Polyphony.trace(true)
|
21
22
|
t.enable
|
22
23
|
snooze
|
23
24
|
t.disable
|
@@ -28,14 +29,14 @@ class TraceTest < MiniTest::Test
|
|
28
29
|
assert_equal [Fiber.current], records.map { |r| r[:fiber] }.uniq
|
29
30
|
ensure
|
30
31
|
t&.disable
|
31
|
-
|
32
|
+
Polyphony.trace(nil)
|
32
33
|
end
|
33
34
|
|
34
35
|
def test_2_fiber_trace
|
35
36
|
records = []
|
36
37
|
t = Polyphony::Trace.new(:fiber_all) { |r| records << r if r[:event] =~ /^fiber_/ }
|
37
38
|
t.enable
|
38
|
-
|
39
|
+
Polyphony.trace(true)
|
39
40
|
|
40
41
|
f = spin { sleep 0 }
|
41
42
|
suspend
|
@@ -61,6 +62,6 @@ class TraceTest < MiniTest::Test
|
|
61
62
|
], events
|
62
63
|
ensure
|
63
64
|
t&.disable
|
64
|
-
|
65
|
+
Polyphony.trace(nil)
|
65
66
|
end
|
66
67
|
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:
|
4
|
+
version: 0.43.2
|
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-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.85.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.85.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pg
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,19 +212,19 @@ dependencies:
|
|
212
212
|
requirements:
|
213
213
|
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: 0.
|
215
|
+
version: 0.3.0
|
216
216
|
type: :development
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
220
|
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version: 0.
|
222
|
+
version: 0.3.0
|
223
223
|
description:
|
224
224
|
email: ciconia@gmail.com
|
225
225
|
executables: []
|
226
226
|
extensions:
|
227
|
-
- ext/
|
227
|
+
- ext/polyphony/extconf.rb
|
228
228
|
extra_rdoc_files:
|
229
229
|
- README.md
|
230
230
|
files:
|
@@ -242,19 +242,14 @@ files:
|
|
242
242
|
- TODO.md
|
243
243
|
- bin/polyphony-debug
|
244
244
|
- docs/_config.yml
|
245
|
-
- docs/_includes/nav.html
|
246
|
-
- docs/_includes/prevnext.html
|
247
|
-
- docs/_layouts/default.html
|
248
245
|
- docs/_sass/custom/custom.scss
|
249
246
|
- docs/_sass/overrides.scss
|
250
|
-
- docs/
|
247
|
+
- docs/_user-guide/all-about-timers.md
|
248
|
+
- docs/_user-guide/index.md
|
249
|
+
- docs/_user-guide/web-server.md
|
251
250
|
- docs/api-reference/exception.md
|
252
251
|
- docs/api-reference/fiber.md
|
253
|
-
- docs/api-reference/
|
254
|
-
- docs/api-reference/gyro-child.md
|
255
|
-
- docs/api-reference/gyro-queue.md
|
256
|
-
- docs/api-reference/gyro-timer.md
|
257
|
-
- docs/api-reference/gyro.md
|
252
|
+
- docs/api-reference/index.md
|
258
253
|
- docs/api-reference/io.md
|
259
254
|
- docs/api-reference/object.md
|
260
255
|
- docs/api-reference/polyphony-baseexception.md
|
@@ -272,23 +267,24 @@ files:
|
|
272
267
|
- docs/assets/img/echo-fibers.svg
|
273
268
|
- docs/assets/img/sleeping-fiber.svg
|
274
269
|
- docs/faq.md
|
275
|
-
- docs/
|
270
|
+
- docs/favicon.ico
|
271
|
+
- docs/getting-started/index.md
|
276
272
|
- docs/getting-started/installing.md
|
273
|
+
- docs/getting-started/overview.md
|
277
274
|
- docs/getting-started/tutorial.md
|
278
275
|
- docs/index.md
|
279
|
-
- docs/main-concepts.md
|
280
276
|
- docs/main-concepts/concurrency.md
|
281
277
|
- docs/main-concepts/design-principles.md
|
282
278
|
- docs/main-concepts/exception-handling.md
|
283
279
|
- docs/main-concepts/extending.md
|
284
280
|
- docs/main-concepts/fiber-scheduling.md
|
285
|
-
- docs/
|
286
|
-
- docs/
|
287
|
-
- docs/user-guide/web-server.md
|
281
|
+
- docs/main-concepts/index.md
|
282
|
+
- docs/polyphony-logo.png
|
288
283
|
- examples/adapters/pg_client.rb
|
289
284
|
- examples/adapters/pg_notify.rb
|
290
285
|
- examples/adapters/pg_pool.rb
|
291
286
|
- examples/adapters/pg_transaction.rb
|
287
|
+
- examples/adapters/redis_blpop.rb
|
292
288
|
- examples/adapters/redis_channels.rb
|
293
289
|
- examples/adapters/redis_client.rb
|
294
290
|
- examples/adapters/redis_pubsub.rb
|
@@ -296,7 +292,8 @@ files:
|
|
296
292
|
- examples/core/01-spinning-up-fibers.rb
|
297
293
|
- examples/core/02-awaiting-fibers.rb
|
298
294
|
- examples/core/03-interrupting.rb
|
299
|
-
- examples/core/
|
295
|
+
- examples/core/04-handling-signals.rb
|
296
|
+
- examples/core/xx-agent.rb
|
300
297
|
- examples/core/xx-at_exit.rb
|
301
298
|
- examples/core/xx-caller.rb
|
302
299
|
- examples/core/xx-channels.rb
|
@@ -359,27 +356,14 @@ files:
|
|
359
356
|
- examples/performance/snooze_raw.rb
|
360
357
|
- examples/performance/thread-vs-fiber/polyphony_mt_server.rb
|
361
358
|
- examples/performance/thread-vs-fiber/polyphony_server.rb
|
359
|
+
- examples/performance/thread-vs-fiber/polyphony_server_read_loop.rb
|
362
360
|
- examples/performance/thread-vs-fiber/threaded_server.rb
|
363
361
|
- examples/performance/thread-vs-fiber/xx-httparty_multi.rb
|
364
362
|
- examples/performance/thread-vs-fiber/xx-httparty_threaded.rb
|
365
363
|
- examples/performance/thread_pool_perf.rb
|
366
|
-
-
|
367
|
-
-
|
368
|
-
-
|
369
|
-
- ext/gyro/fiber.c
|
370
|
-
- ext/gyro/gyro.c
|
371
|
-
- ext/gyro/gyro.h
|
372
|
-
- ext/gyro/gyro_ext.c
|
373
|
-
- ext/gyro/io.c
|
374
|
-
- ext/gyro/libev.c
|
375
|
-
- ext/gyro/libev.h
|
376
|
-
- ext/gyro/queue.c
|
377
|
-
- ext/gyro/selector.c
|
378
|
-
- ext/gyro/signal.c
|
379
|
-
- ext/gyro/socket.c
|
380
|
-
- ext/gyro/thread.c
|
381
|
-
- ext/gyro/timer.c
|
382
|
-
- ext/gyro/tracing.c
|
364
|
+
- examples/performance/xx-array.rb
|
365
|
+
- examples/performance/xx-fiber-switch.rb
|
366
|
+
- examples/performance/xx-snooze.rb
|
383
367
|
- ext/libev/Changes
|
384
368
|
- ext/libev/LICENSE
|
385
369
|
- ext/libev/README
|
@@ -396,6 +380,17 @@ files:
|
|
396
380
|
- ext/libev/ev_win32.c
|
397
381
|
- ext/libev/ev_wrap.h
|
398
382
|
- ext/libev/test_libev_win32.c
|
383
|
+
- ext/polyphony/extconf.rb
|
384
|
+
- ext/polyphony/fiber.c
|
385
|
+
- ext/polyphony/libev.c
|
386
|
+
- ext/polyphony/libev.h
|
387
|
+
- ext/polyphony/libev_agent.c
|
388
|
+
- ext/polyphony/libev_queue.c
|
389
|
+
- ext/polyphony/polyphony.c
|
390
|
+
- ext/polyphony/polyphony.h
|
391
|
+
- ext/polyphony/polyphony_ext.c
|
392
|
+
- ext/polyphony/thread.c
|
393
|
+
- ext/polyphony/tracing.c
|
399
394
|
- lib/polyphony.rb
|
400
395
|
- lib/polyphony/adapters/fs.rb
|
401
396
|
- lib/polyphony/adapters/irb.rb
|
@@ -410,6 +405,7 @@ files:
|
|
410
405
|
- lib/polyphony/core/sync.rb
|
411
406
|
- lib/polyphony/core/thread_pool.rb
|
412
407
|
- lib/polyphony/core/throttler.rb
|
408
|
+
- lib/polyphony/event.rb
|
413
409
|
- lib/polyphony/extensions/core.rb
|
414
410
|
- lib/polyphony/extensions/fiber.rb
|
415
411
|
- lib/polyphony/extensions/io.rb
|
@@ -424,20 +420,22 @@ files:
|
|
424
420
|
- test/helper.rb
|
425
421
|
- test/run.rb
|
426
422
|
- test/stress.rb
|
427
|
-
- test/
|
423
|
+
- test/test_agent.rb
|
424
|
+
- test/test_event.rb
|
428
425
|
- test/test_ext.rb
|
429
426
|
- test/test_fiber.rb
|
430
427
|
- test/test_global_api.rb
|
431
428
|
- test/test_io.rb
|
432
429
|
- test/test_kernel.rb
|
433
430
|
- test/test_process_supervision.rb
|
431
|
+
- test/test_queue.rb
|
434
432
|
- test/test_resource_pool.rb
|
435
433
|
- test/test_signal.rb
|
434
|
+
- test/test_socket.rb
|
436
435
|
- test/test_supervise.rb
|
437
436
|
- test/test_thread.rb
|
438
437
|
- test/test_thread_pool.rb
|
439
438
|
- test/test_throttler.rb
|
440
|
-
- test/test_timer.rb
|
441
439
|
- test/test_trace.rb
|
442
440
|
homepage: https://digital-fabric.github.io/polyphony
|
443
441
|
licenses:
|
data/docs/_includes/nav.html
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
<nav role="navigation" aria-label="Main navigation">
|
2
|
-
<ul class="navigation-list">
|
3
|
-
{%- assign pages_list = site.html_pages | sort:"nav_order" -%}
|
4
|
-
{%- for node in pages_list -%}
|
5
|
-
{%- unless node.nav_exclude -%}
|
6
|
-
{%- if node.parent == nil -%}
|
7
|
-
<li class="navigation-list-item
|
8
|
-
{% if page.url == node.url %} active{% endif %}
|
9
|
-
{% if node.section %}section-title{% endif %}
|
10
|
-
">
|
11
|
-
{%- if page.parent == node.title or page.grand_parent == node.title -%}
|
12
|
-
{%- assign first_level_url = node.section_link | node.url | absolute_url -%}
|
13
|
-
{%- endif -%}
|
14
|
-
{%- if node.section -%}
|
15
|
-
<span class="section-title">{{ node.title }}</span>
|
16
|
-
{%- else -%}
|
17
|
-
<a href="{{ node.url | absolute_url }}" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
|
18
|
-
{%- endif -%}
|
19
|
-
{%- if node.has_children -%}
|
20
|
-
{%- if node.alphabetical_order -%}
|
21
|
-
{%- assign children_list = site.html_pages | where: "parent", node.title | sort:"title" -%}
|
22
|
-
{%- else -%}
|
23
|
-
{%- assign children_list = site.html_pages | where: "parent", node.title | sort:"nav_order" -%}
|
24
|
-
{%- endif -%}
|
25
|
-
<ul class="navigation-list-child-list ">
|
26
|
-
{%- for child in children_list -%}
|
27
|
-
<li class="navigation-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
|
28
|
-
{%- if page.url == child.url or page.parent == child.title -%}
|
29
|
-
{%- assign second_level_url = child.url | absolute_url -%}
|
30
|
-
{%- endif -%}
|
31
|
-
<a href="{{ child.url | absolute_url }}" class="navigation-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
|
32
|
-
{%- if child.has_children -%}
|
33
|
-
{%- assign grand_children_list = site.html_pages | where: "parent", child.title | sort:"nav_order" -%}
|
34
|
-
<ul class="navigation-list-child-list">
|
35
|
-
{%- for grand_child in grand_children_list -%}
|
36
|
-
<li class="navigation-list-item {% if page.url == grand_child.url %} active{% endif %}">
|
37
|
-
<a href="{{ grand_child.url | absolute_url }}" class="navigation-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
|
38
|
-
</li>
|
39
|
-
{%- endfor -%}
|
40
|
-
</ul>
|
41
|
-
{%- endif -%}
|
42
|
-
</li>
|
43
|
-
{%- endfor -%}
|
44
|
-
</ul>
|
45
|
-
{%- endif -%}
|
46
|
-
</li>
|
47
|
-
{%- endif -%}
|
48
|
-
{%- endunless -%}
|
49
|
-
{%- endfor -%}
|
50
|
-
</ul>
|
51
|
-
</nav>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
{%- for node in site.html_pages -%}
|
2
|
-
{%- if page.prev_title == node.title -%}
|
3
|
-
{%- assign prev_url = node.url -%}
|
4
|
-
{%- endif -%}
|
5
|
-
{%- if page.next_title == node.title -%}
|
6
|
-
{%- assign next_url = node.url -%}
|
7
|
-
{%- endif -%}
|
8
|
-
{%- endfor -%}
|
9
|
-
<div id="prevnext">
|
10
|
-
{%- if prev_url -%}
|
11
|
-
<span class="prev"><a href="{{prev_url | relative_url}}">☜ {{page.prev_title}}</a></span>
|
12
|
-
{%- endif -%}
|
13
|
-
{%- if next_url -%}
|
14
|
-
<span class="next"><a href="{{next_url | relative_url}}">{{page.next_title}} ☞</a></span>
|
15
|
-
{%- endif -%}
|
16
|
-
<span class="clear"> </span>
|
17
|
-
</div>
|
data/docs/_layouts/default.html
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
---
|
2
|
-
layout: table_wrappers
|
3
|
-
---
|
4
|
-
|
5
|
-
<!DOCTYPE html>
|
6
|
-
|
7
|
-
<html lang="{{ site.lang | default: "en-US" }}">
|
8
|
-
{% include head.html %}
|
9
|
-
<body>
|
10
|
-
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
|
11
|
-
<symbol id="link" viewBox="0 0 16 16">
|
12
|
-
<title>Link</title>
|
13
|
-
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path>
|
14
|
-
</symbol>
|
15
|
-
</svg>
|
16
|
-
|
17
|
-
<div class="page-wrap">
|
18
|
-
<div class="side-bar">
|
19
|
-
<div class="site-header">
|
20
|
-
<a href="{{ site.url }}{{ site.baseurl }}" class="site-title lh-tight">{% include title.html %}</a>
|
21
|
-
<button class="menu-button fs-3 js-main-nav-trigger" data-text-toggle="Hide" type="button">Menu</button>
|
22
|
-
</div>
|
23
|
-
|
24
|
-
<div class="navigation main-nav js-main-nav">
|
25
|
-
{% include nav.html %}
|
26
|
-
</div>
|
27
|
-
<footer class="site-footer">
|
28
|
-
<p class="text-small text-grey-dk-000 mb-4">This site uses <a href="https://github.com/pmarsceill/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll.</p>
|
29
|
-
</footer>
|
30
|
-
</div>
|
31
|
-
<div class="main-content-wrap js-main-content" tabindex="0">
|
32
|
-
<div class="main-content">
|
33
|
-
<div class="page-header js-page-header">
|
34
|
-
{% if site.search_enabled != false %}
|
35
|
-
<div class="search">
|
36
|
-
<div class="search-input-wrap">
|
37
|
-
<input type="text" class="js-search-input search-input" tabindex="0" placeholder="Search {{ site.title }}" aria-label="Search {{ site.title }}" autocomplete="off">
|
38
|
-
<svg width="14" height="14" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" class="search-icon"><title>Search</title><g fill-rule="nonzero"><path d="M17.332 20.735c-5.537 0-10-4.6-10-10.247 0-5.646 4.463-10.247 10-10.247 5.536 0 10 4.601 10 10.247s-4.464 10.247-10 10.247zm0-4c3.3 0 6-2.783 6-6.247 0-3.463-2.7-6.247-6-6.247s-6 2.784-6 6.247c0 3.464 2.7 6.247 6 6.247z"/><path d="M11.672 13.791L.192 25.271 3.02 28.1 14.5 16.62z"/></g></svg>
|
39
|
-
</div>
|
40
|
-
<div class="js-search-results search-results-wrap"></div>
|
41
|
-
</div>
|
42
|
-
{% endif %}
|
43
|
-
{% if site.aux_links != nil %}
|
44
|
-
<ul class="list-style-none text-small aux-nav">
|
45
|
-
{% for link in site.aux_links %}
|
46
|
-
<li class="d-inline-block my-0{% unless forloop.last %} mr-2{% endunless %}"><a href="{{ link.last }}">{{ link.first }}</a></li>
|
47
|
-
{% endfor %}
|
48
|
-
</ul>
|
49
|
-
{% endif %}
|
50
|
-
</div>
|
51
|
-
<div class="page">
|
52
|
-
{% unless page.url == "/" %}
|
53
|
-
{% if page.parent %}
|
54
|
-
<nav class="breadcrumb-nav">
|
55
|
-
<ol class="breadcrumb-nav-list">
|
56
|
-
{% if page.grand_parent %}
|
57
|
-
<li class="breadcrumb-nav-list-item"><a href="{{ first_level_url }}">{{ page.grand_parent }}</a></li>
|
58
|
-
<li class="breadcrumb-nav-list-item"><a href="{{ second_level_url }}">{{ page.parent }}</a></li>
|
59
|
-
{% else %}
|
60
|
-
<li class="breadcrumb-nav-list-item"><a href="{{ first_level_url }}">{{ page.parent }}</a></li>
|
61
|
-
{% endif %}
|
62
|
-
<li class="breadcrumb-nav-list-item"><span>{{ page.title }}</span></li>
|
63
|
-
</ol>
|
64
|
-
</nav>
|
65
|
-
{% endif %}
|
66
|
-
{% endunless %}
|
67
|
-
<div id="main-content" class="page-content" role="main">
|
68
|
-
{% if site.heading_anchors != false %}
|
69
|
-
{% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><use xlink:href=\"#link\"></use></svg>" anchorClass="anchor-heading" %}
|
70
|
-
{% else %}
|
71
|
-
{{ content }}
|
72
|
-
{% endif %}
|
73
|
-
|
74
|
-
{% if page.prev_title or page.next_title %}
|
75
|
-
{% include prevnext.html %}
|
76
|
-
{% endif %}
|
77
|
-
|
78
|
-
{% if page.has_children == true and page.has_toc != false %}
|
79
|
-
<hr>
|
80
|
-
<h2 class="text-delta">Table of contents</h2>
|
81
|
-
{% assign children_list = site.pages | sort:"nav_order" %}
|
82
|
-
<ul>
|
83
|
-
{% for child in children_list %}
|
84
|
-
{% if child.parent == page.title and child.title != page.title %}
|
85
|
-
<li>
|
86
|
-
<a href="{{ child.url | absolute_url }}">{{ child.title }}</a>{% if child.summary %} - {{ child.summary }}{% endif %}
|
87
|
-
</li>
|
88
|
-
{% endif %}
|
89
|
-
{% endfor %}
|
90
|
-
</ul>
|
91
|
-
{% endif %}
|
92
|
-
|
93
|
-
{% if site.footer_content != nil %}
|
94
|
-
<hr>
|
95
|
-
<footer role="contentinfo">
|
96
|
-
<p class="text-small text-grey-dk-000 mb-0">{{ site.footer_content }}</p>
|
97
|
-
</footer>
|
98
|
-
{% endif %}
|
99
|
-
|
100
|
-
</div>
|
101
|
-
</div>
|
102
|
-
</div>
|
103
|
-
</div>
|
104
|
-
|
105
|
-
</body>
|
106
|
-
</html>
|
data/docs/api-reference.md
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
---
|
2
|
-
layout: page
|
3
|
-
title: Gyro::Async
|
4
|
-
parent: API Reference
|
5
|
-
permalink: /api-reference/gyro-async/
|
6
|
-
---
|
7
|
-
# Gyro::Async
|
8
|
-
|
9
|
-
`Gyro::Async` encapsulates a libev [async
|
10
|
-
watcher](http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#code_ev_async_code_how_to_wake_up_an),
|
11
|
-
allowing thread-safe synchronisation and signalling. `Gyro::Async` watchers are
|
12
|
-
used both directly and indirectly in Polyphony to implement
|
13
|
-
[queues](../gyro-queue/), await fibers and threads, and auxiliary features such
|
14
|
-
as [thread pools](../polyphony-threadpool/).
|
15
|
-
|
16
|
-
A `Gyro::Async` watcher instance is shared across two or more fibers (across one
|
17
|
-
or more threads), where one fiber waits to be signalled by calling
|
18
|
-
`Gyro::Async#await`, and one or more other fibers do the signalling by calling
|
19
|
-
`Gyro::Async#signal`:
|
20
|
-
|
21
|
-
```ruby
|
22
|
-
async = Gyro::Async.new
|
23
|
-
spin do
|
24
|
-
sleep 1
|
25
|
-
async.signal
|
26
|
-
end
|
27
|
-
|
28
|
-
async.await
|
29
|
-
```
|
30
|
-
|
31
|
-
The signalling of async watchers is compressed, which means that multiple
|
32
|
-
invocations of `Gyro::Async#signal` before the event loop can continue will
|
33
|
-
result the watcher being signalled just a single time.
|
34
|
-
|
35
|
-
In addition to signalling, the async watcher can also be used to transfer an
|
36
|
-
arbitrary value to the awaitng fiber. See `#signal` for an example.
|
37
|
-
|
38
|
-
## Instance methods
|
39
|
-
|
40
|
-
### #await → object
|
41
|
-
|
42
|
-
Blocks the current thread until the watcher is signalled.
|
43
|
-
|
44
|
-
### #initialize
|
45
|
-
|
46
|
-
Initializes the watcher instance.
|
47
|
-
|
48
|
-
### #signal(value = nil) → async
|
49
|
-
|
50
|
-
Signals the watcher, causing the fiber awaiting the watcher to become runnable
|
51
|
-
and be eventually resumed with the given value.
|
52
|
-
|
53
|
-
```ruby
|
54
|
-
async = Gyro::Async.new
|
55
|
-
spin { async.signal('foo') }
|
56
|
-
async.await #=> 'foo'
|
57
|
-
```
|