async-interop / event-loop

An event loop interface for interoperability in PHP.
MIT License
169 stars 9 forks source link

Detect active Loop #113

Closed joelwurtz closed 7 years ago

joelwurtz commented 7 years ago

See https://github.com/async-interop/promise/pull/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;
        }
    }
kelunik commented 7 years ago

We don't. This will be removed soon.

bwoebi commented 7 years ago

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.

kelunik commented 7 years ago

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

joelwurtz commented 7 years ago

Fine for me yes, thanks !