NAME
UniEvent::Check - run the given callback once per loop iteration, right after polling for i/o.
SYNOPSIS
my
$h
= UniEvent::Check->new(
$loop
);
$h
->event->add(
sub
{
say
'hello'
});
$h
->start;
$loop
->run_nowait;
# prints 'hello'
$loop
->run_nowait;
# prints 'hello' again
$h
->stop;
$loop
->run_nowait;
# no effect
$h
= UE::check
sub
{ ... },
$loop
;
DESCRIPTION
The Check handle is useful for doing post-I/O actions for a loop. It is inherited from UniEvent::Handle.
METHODS
All methods of UniEvent::Handle also apply.
create($callback, [$loop = default])
my
$handle
= UniEvent::Check->create(
sub
{
say
"hi"
});
Creates and starts a check handle. Alias for new($loop)
+ start($callback)
.
new([$loop = default])
Constructs new Check handle and binds it to the specified event loop
start([$callback])
Starts the check handle, i.e. makes it active for the next even loop iteration. Optionally it adds the $callback
to the event listeners.
stop()
Stops the check handle, i.e. makes it inactive for the next event loop iteration.
callback($sub)
event()
Callback signature:
my
$handle
=
shift
;
# the "check" handle itself
See "EVENT CALLBACKS" in UniEvent
event_listener($delegate, [$weak])
Method on_check
will be called.
See "EVENT LISTENER" in UniEvent
call_now()
Immediately invokes assigned callbacks and listeners.