# ext/pcntl asynchronous sugnal handling

- Thread: https://externals.io/message/94221
- Original archive: https://news-web.php.net/php.internals/94221
- Started by Dmitry Stogov on 2016-06-23T12:19:39+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #94221 — Dmitry Stogov — 2016-06-23T12:19:39+00:00

URL: https://externals.io/message/94221#94221

Hi,


Currently OS signals may be handled through ext/pcntl:

- synchronously, calling `pcntl_signal_dispatch()` manually

- asynchronously, if PHP scripts compiled with declare(ticks=N);


The simple patch uses the recently added into Zend Engine ability and allows asynchronous signal handling without extra ZEND_TICKs (without any run-time overhead).


https://gist.github.com/dstogov/01d1002c1785f82eaac4b937ccaf418f


Accepting this would probably need RFC.


Thanks. Dmitry.

---

## #94222 — Nikita Popov — 2016-06-23T12:28:09+00:00

URL: https://externals.io/message/94221#94222 · In reply to: #94221

> Hi,
>
>
> Currently OS signals may be handled through ext/pcntl:
>
> - synchronously, calling `pcntl_signal_dispatch()` manually
>
> - asynchronously, if PHP scripts compiled with declare(ticks=N);
>
>
> The simple patch uses the recently added into Zend Engine ability and
> allows asynchronous signal handling without extra ZEND_TICKs (without any
> run-time overhead).
>
>
> https://gist.github.com/dstogov/01d1002c1785f82eaac4b937ccaf418f
>
>
> Accepting this would probably need RFC.
>

Line 43 should probably call orig_interrupt_function.

I'm +10 on this change. Using ticks for interrupt handling was horrible,
and since PHP 7 doesn't really work anyway.

Nikita

---

## #94224 — Michael Wallner — 2016-06-23T13:17:36+00:00

URL: https://externals.io/message/94221#94224 · In reply to: #94222

> 
> 
> 
> 
> > […]
> 
> Line 43 should probably call orig_interrupt_function.
> 
> I'm +10 on this change. Using ticks for interrupt handling was horrible,
> and since PHP 7 doesn't really work anyway.
> 

Another +10 here!
