EV-Loop-Async

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        (can be instantaneous, or take a few hours).

        No locking is required.

        Example: lock the loop, create a timer, nudge the loop so it takes
        notice of the new timer, then evily busy-wait till the timer fires.

           my $timer;
           my $flag;

           {
              $loop->scope_lock;
              $timer = $loop->timer (1, 0, sub { $flag = 1 });
              $loop->notify;
           }

           1 until $flag;

    $loop->lock
    $loop->unlock
        Lock/unlock the loop data structures. Since the event loop runs in a
        separate thread, you have to lock the loop data structures before
        accessing them in any way. Since I was lazy, you have to do this
        manually.

        You must lock under the same conditions as you would have to lock
        the underlying C library, e.g. when starting or stopping watchers
        (but not when creating or destroying them, but note that create and
        destroy often starts and stops for you, in which case you have to
        lock).

        When in doubt, lock.

        See also the next method, "$loop->scope_lock" for a more failsafe
        way to lock parts of your code.

        Note that there must be exactly one call of "unblock" for every
        previous call to "block" (i.e. calls can nest).

    $loop->scope_lock
        Calls "lock" immediately, and "unlock" automatically whent he
        current scope is left.

    $loop->set_max_foreground_loops ($max_loops)
        The background loop will immediately stop polling for new events
        after it has collected at least one new event, regardless of how
        long it then takes to actually handle them.

        When Perl finally handles the events, there could be many more ready
        file descriptors. To improve latency and performance, you can ask
        "EV::Loop::Async" to loop an additional number of times in the
        foreground after invoking the callbacks, effectively doing the
        polling in the foreground.

        The default is 0, meaning that no foreground polling will be done. A
        value of 1 means that, after handling the pending events, it will
        call "$loop->loop (EV::LOOP_NONBLOCK)" and handle the resulting
        events, if any. A value of 2 means that this will be iterated twice.

        When a foreground event poll does not yield any new events, then no
        further iterations will be made, so this is only a *maximum* value
        of additional loop runs.

        Take also note of the standard EV "set_io_collect_interval"
        functionality, which can achieve a similar, but different, effect -
        YMMV.

SEE ALSO
    EV, Async::Interrupt.

AUTHOR
     Marc Lehmann <schmorp@schmorp.de>
     http://home.schmorp.de/



( run in 0.483 second using v1.01-cache-2.11-cpan-71847e10f99 )