async-interop/event-loop

Detect active Loop

joelwurtz opened this issue · 4 comments

See async-interop/promise#17 which introduces the notion of active loop :

If there is no active loop, and one of the callbacks....

How do we check if there is or isn't an active loop ? I'm wondering if this should be specificied in this standard or we should do the following:

    function hasLoop()
    {
        try {
            Loop::get();

            return true;
        } catch (\LogicException $exception) {
            return false;
        }
    }

We don't. This will be removed soon.

Depending on knowledge whether the loop is active is a bad idea, this was a bad decision in my PR and it rightfully got not merged in the promise repo.

@joelwurtz Can I close this issue? You won't have to know whether a loop is active.

Fine for me yes, thanks !