Sha256: d762854c0753516b0f8279945ac63de5fbbdd878b36eb0356029b017d6472e91

Contents?: true

Size: 1.25 KB

Versions: 93

Compression:

Stored size: 1.25 KB

Contents

---
layout: page
title: Polyphony
parent: API Reference
permalink: /api-reference/polyphony/
---
# Polyphony

The `Polyphony` module acts as a namespace containing general Polyphony
functionalities.

## Class Methods

### #emit_signal_exception(exception, fiber = Thread.main.main_fiber) → thread

Emits an exception to the given fiber from a signal handler.

### #fork({ block }) → pid

Forks a child process running the given block. Due to the way Ruby implements
fibers, along with how signals interact with them, Polyphony-based applications
should use `Polyphony#fork` rather than `Kernel#fork`. In order to continue
handling fiber scheduling and signal handling correctly, the child process does
the following:

- A new fiber is created using `Fiber#new` and control is transferred to it.
- Notify the event loop that a fork has occurred (by calling `ev_loop_fork`).
- Setup the current fiber as the main thread's main fiber.
- Setup fiber scheduling for the main thread.
- Install fiber-aware signal handlers for the `TERM` and `INT` signals.
- Run the block.
- Correctly handle uncaught exceptions, including `SystemExit` and `Interrupt`.

### #watch_process(cmd = nil, { block })

Alternative for [`Polyphony::Process.watch`](../polyphony-process/#watchcmd--nil--block-).

Version data entries

93 entries across 93 versions & 1 rubygems

Version Path
polyphony-0.99 docs/api-reference/polyphony.md
polyphony-0.98 docs/api-reference/polyphony.md
polyphony-0.97 docs/api-reference/polyphony.md
polyphony-0.96 docs/api-reference/polyphony.md
polyphony-0.95 docs/api-reference/polyphony.md
polyphony-0.94 docs/api-reference/polyphony.md
polyphony-0.93 docs/api-reference/polyphony.md
polyphony-0.92 docs/api-reference/polyphony.md
polyphony-0.91 docs/api-reference/polyphony.md
polyphony-0.90 docs/api-reference/polyphony.md
polyphony-0.89 docs/api-reference/polyphony.md
polyphony-0.87 docs/api-reference/polyphony.md
polyphony-0.86 docs/api-reference/polyphony.md
polyphony-0.85 docs/api-reference/polyphony.md
polyphony-0.84.1 docs/api-reference/polyphony.md
polyphony-0.84 docs/api-reference/polyphony.md
polyphony-0.83 docs/api-reference/polyphony.md
polyphony-0.82 docs/api-reference/polyphony.md
polyphony-0.81.1 docs/api-reference/polyphony.md
polyphony-0.81 docs/api-reference/polyphony.md