Event-polling after a fork

Felipe Gasper felipe at felipegasper.com
Tue Feb 25 13:27:59 CET 2020


> On Feb 24, 2020, at 6:35 PM, Art Sackett <asackett at gmx.com> wrote:
> 
> On Mon, Feb 24, 2020 at 10:58:07AM -0500, Felipe Gasper wrote:
> 
>> or what else have folks done to use event-polling in children spawned
>> from an event-polling parent?
> 
> AnyEvent::Fork
> AnyEvent::Fork::Early
> AnyEvent::Fork::Pool

These are all a bit more elaborate than what I’m looking for. I was hoping for something lower-level, like:

my $pid = fork or do {
    AnyEvent->reset();

    # … and so on …
};

This appears to be Mojo::IOLoop’s solution to this problem. Would it be feasible to do something similar in AnyEvent? Most of AE’s event loop backends seem to be part of the distribution anyway, so whichever loops don’t add reset() could simply throw.

-F


More information about the anyevent mailing list