You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 90302f9
Browse filesBrowse the repository at this point in the historyBrowse files
Add the benchmarks suite; restore() cancels the scoped context
CI failed: testo.php declares a Benchmarks suite and the empty directory is
not tracked by git. The new benchmark showed a leak: every scope derives
withCancel() from the parent and restore() left it attached, so a scope per
job under a long-lived parent accumulated children. restore() now cancels
the scoped context like Go's NotifyContext stop, after applying a pending
signal so its cause is kept.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,7 +96,7 @@ $scope->signal(); // the first signal received, or null
96
96
|---|---|
97
97
| First signal of the set |`requestCancel(new SignalReceived($signal))`. Nothing else runs in the handler; the next check terminates the context, runs its `onTerminate()` listeners and throws `ContextCancelledException` with the `SignalReceived` as `previous`|
98
98
| Second signal of the set | The scope restores the previous handlers and hands this signal to them: a PHP handler is called, the default disposition terminates the process (Ctrl+C twice stops a stuck worker), an ignored signal stays ignored |
99
-
|`restore()`| Previous handlers and the previous `pcntl_async_signals()` mode come back; idempotent; the context keeps its state|
99
+
|`restore()`| Previous handlers and the previous `pcntl_async_signals()` mode come back, then the scoped context is cancelled (like Go's `NotifyContext` stop) so it never stays attached to a long-lived parent; a signal cause already received is kept; idempotent|
100
100
| Parent cancelled/expired | The scoped context terminates with it (it is `$parent->withCancel()`) |
101
101
|`SIGKILL`, `SIGSTOP`, duplicates, empty set |`InvalidArgumentException` before anything is installed |
102
102
| A signal already owned by another active scope |`LogicException`|
Copy file name to clipboardExpand all lines: README.ru.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,7 @@ $scope->signal(); // первый полученный сигнал или nul
98
98
|---|---|
99
99
| Первый сигнал из набора |`requestCancel(new SignalReceived($signal))`. Больше в обработчике ничего не исполняется; следующая проверка завершает контекст, вызывает его `onTerminate()`-слушателей и бросает `ContextCancelledException` с `SignalReceived` в `previous`|
100
100
| Второй сигнал из набора | Scope восстанавливает прежние обработчики и передаёт им этот сигнал: PHP-обработчик вызывается, поведение по умолчанию завершает процесс (двойной Ctrl+C останавливает зависший воркер), игнорируемый сигнал остаётся игнорируемым |
101
-
|`restore()`| Возвращаются прежние обработчики и прежний режим `pcntl_async_signals()`; идемпотентен; состояние контекста не меняется|
101
+
|`restore()`| Возвращаются прежние обработчики и прежний режим `pcntl_async_signals()`, затем контекст scope отменяется (как `stop()` у `NotifyContext` в Go), чтобы он не остался навсегда привязан к долгоживущему родителю; уже полученная причина-сигнал сохраняется; идемпотентен|
102
102
| Родитель отменён/истёк | Контекст scope завершается вместе с ним (это `$parent->withCancel()`) |
103
103
|`SIGKILL`, `SIGSTOP`, дубликаты, пустой набор |`InvalidArgumentException` до установки чего-либо |
104
104
| Сигнал уже занят другим активным scope |`LogicException`|
0 commit comments