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.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +11 -2
  3. data/.gitignore +2 -2
  4. data/.rubocop.yml +30 -0
  5. data/CHANGELOG.md +29 -2
  6. data/Gemfile.lock +13 -10
  7. data/README.md +0 -1
  8. data/Rakefile +3 -3
  9. data/TODO.md +27 -97
  10. data/docs/_config.yml +56 -7
  11. data/docs/_sass/custom/custom.scss +6 -26
  12. data/docs/_sass/overrides.scss +0 -46
  13. data/docs/{user-guide → _user-guide}/all-about-timers.md +0 -0
  14. data/docs/_user-guide/index.md +9 -0
  15. data/docs/{user-guide → _user-guide}/web-server.md +0 -0
  16. data/docs/api-reference/fiber.md +2 -2
  17. data/docs/api-reference/index.md +9 -0
  18. data/docs/api-reference/polyphony-process.md +1 -1
  19. data/docs/api-reference/thread.md +1 -1
  20. data/docs/faq.md +21 -11
  21. data/docs/favicon.ico +0 -0
  22. data/docs/getting-started/index.md +10 -0
  23. data/docs/getting-started/installing.md +2 -6
  24. data/docs/getting-started/overview.md +486 -0
  25. data/docs/getting-started/tutorial.md +27 -19
  26. data/docs/index.md +6 -2
  27. data/docs/main-concepts/concurrency.md +0 -5
  28. data/docs/main-concepts/design-principles.md +69 -21
  29. data/docs/main-concepts/extending.md +1 -1
  30. data/docs/main-concepts/index.md +9 -0
  31. data/docs/polyphony-logo.png +0 -0
  32. data/examples/adapters/redis_blpop.rb +12 -0
  33. data/examples/core/01-spinning-up-fibers.rb +1 -0
  34. data/examples/core/03-interrupting.rb +4 -1
  35. data/examples/core/04-handling-signals.rb +19 -0
  36. data/examples/core/xx-agent.rb +102 -0
  37. data/examples/core/xx-sleeping.rb +14 -6
  38. data/examples/io/xx-irb.rb +1 -1
  39. data/examples/performance/thread-vs-fiber/polyphony_mt_server.rb +7 -6
  40. data/examples/performance/thread-vs-fiber/polyphony_server.rb +13 -36
  41. data/examples/performance/thread-vs-fiber/polyphony_server_read_loop.rb +58 -0
  42. data/examples/performance/xx-array.rb +11 -0
  43. data/examples/performance/xx-fiber-switch.rb +9 -0
  44. data/examples/performance/xx-snooze.rb +15 -0
  45. data/ext/{gyro → polyphony}/extconf.rb +2 -2
  46. data/ext/{gyro → polyphony}/fiber.c +15 -22
  47. data/ext/{gyro → polyphony}/libev.c +0 -0
  48. data/ext/{gyro → polyphony}/libev.h +0 -0
  49. data/ext/polyphony/libev_agent.c +725 -0
  50. data/ext/polyphony/libev_queue.c +217 -0
  51. data/ext/{gyro/gyro.c → polyphony/polyphony.c} +12 -37
  52. data/ext/polyphony/polyphony.h +90 -0
  53. data/ext/polyphony/polyphony_ext.c +21 -0
  54. data/ext/{gyro → polyphony}/thread.c +34 -151
  55. data/ext/{gyro → polyphony}/tracing.c +1 -1
  56. data/lib/polyphony.rb +19 -12
  57. data/lib/polyphony/adapters/irb.rb +1 -1
  58. data/lib/polyphony/adapters/postgres.rb +6 -5
  59. data/lib/polyphony/adapters/process.rb +5 -5
  60. data/lib/polyphony/adapters/redis.rb +3 -2
  61. data/lib/polyphony/adapters/trace.rb +28 -28
  62. data/lib/polyphony/core/channel.rb +3 -3
  63. data/lib/polyphony/core/exceptions.rb +1 -1
  64. data/lib/polyphony/core/global_api.rb +13 -11
  65. data/lib/polyphony/core/resource_pool.rb +3 -3
  66. data/lib/polyphony/core/sync.rb +2 -2
  67. data/lib/polyphony/core/thread_pool.rb +6 -6
  68. data/lib/polyphony/core/throttler.rb +13 -6
  69. data/lib/polyphony/event.rb +27 -0
  70. data/lib/polyphony/extensions/core.rb +22 -14
  71. data/lib/polyphony/extensions/fiber.rb +4 -4
  72. data/lib/polyphony/extensions/io.rb +59 -25
  73. data/lib/polyphony/extensions/openssl.rb +36 -16
  74. data/lib/polyphony/extensions/socket.rb +28 -10
  75. data/lib/polyphony/extensions/thread.rb +16 -9
  76. data/lib/polyphony/net.rb +9 -9
  77. data/lib/polyphony/version.rb +1 -1
  78. data/polyphony.gemspec +3 -3
  79. data/test/helper.rb +12 -1
  80. data/test/test_agent.rb +130 -0
  81. data/test/{test_async.rb → test_event.rb} +13 -7
  82. data/test/test_ext.rb +25 -4
  83. data/test/test_fiber.rb +19 -10
  84. data/test/test_global_api.rb +6 -6
  85. data/test/test_io.rb +46 -24
  86. data/test/test_queue.rb +74 -0
  87. data/test/test_signal.rb +3 -40
  88. data/test/test_socket.rb +34 -0
  89. data/test/test_thread.rb +37 -16
  90. data/test/test_trace.rb +6 -5
  91. metadata +39 -41
  92. data/docs/_includes/nav.html +0 -51
  93. data/docs/_includes/prevnext.html +0 -17
  94. data/docs/_layouts/default.html +0 -106
  95. data/docs/api-reference.md +0 -11
  96. data/docs/api-reference/gyro-async.md +0 -57
  97. data/docs/api-reference/gyro-child.md +0 -29
  98. data/docs/api-reference/gyro-queue.md +0 -44
  99. data/docs/api-reference/gyro-timer.md +0 -51
  100. data/docs/api-reference/gyro.md +0 -25
  101. data/docs/getting-started.md +0 -10
  102. data/docs/main-concepts.md +0 -10
  103. data/docs/user-guide.md +0 -10
  104. data/examples/core/forever_sleep.rb +0 -19
  105. data/ext/gyro/async.c +0 -132
  106. data/ext/gyro/child.c +0 -108
  107. data/ext/gyro/gyro.h +0 -158
  108. data/ext/gyro/gyro_ext.c +0 -33
  109. data/ext/gyro/io.c +0 -457
  110. data/ext/gyro/queue.c +0 -146
  111. data/ext/gyro/selector.c +0 -205
  112. data/ext/gyro/signal.c +0 -99
  113. data/ext/gyro/socket.c +0 -213
  114. data/ext/gyro/timer.c +0 -115
  115. data/test/test_timer.rb +0 -56
@@ -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
- Gyro.trace(nil)
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
- Gyro.trace(true)
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
- Gyro.trace(nil)
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
- Gyro.trace(true)
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
- Gyro.trace(nil)
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: '0.40'
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-05-04 00:00:00.000000000 Z
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.80.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.80.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.2.7
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.2.7
222
+ version: 0.3.0
223
223
  description:
224
224
  email: ciconia@gmail.com
225
225
  executables: []
226
226
  extensions:
227
- - ext/gyro/extconf.rb
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/api-reference.md
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/gyro-async.md
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/getting-started.md
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/user-guide.md
286
- - docs/user-guide/all-about-timers.md
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/forever_sleep.rb
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
- - ext/gyro/async.c
367
- - ext/gyro/child.c
368
- - ext/gyro/extconf.rb
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/test_async.rb
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:
@@ -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">&nbsp;</span>
17
- </div>
@@ -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>
@@ -1,11 +0,0 @@
1
- ---
2
- layout: page
3
- title: API Reference
4
- description: Lorem ipsum
5
- has_children: true
6
- alphabetical_order: true
7
- section: true
8
- has_toc: false
9
- nav_order: 5
10
- section_link: /api-reference/exception
11
- ---
@@ -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
- ```