©
本文檔使用 php中文網手册 發布
(PECL ev >= 0.2.0)
Represents an event loop that is always distinct from the default loop . Unlike the default loop , it cannot handle EvChild watchers.
Having threads we have to create a loop per thread, and use the the default loop in the parent thread.
The default event loop is initialized automatically by Ev . It is accessable via methods of the Ev class, or via EvLoop::defaultLoop() method.
$callback
[, string $data
[, string $priority
]] )$pid
, string $trace
, string $callback
[, string $data
[, string $priority
]] )$flags
[, mixed $data
= NULL
[, double $io_interval
= 0.0
[, double $timeout_interval
= 0.0
]]]] )$flags
= Ev::FLAG_AUTO
[, mixed $data
= NULL
[, double $io_interval
= 0.
[, double $timeout_interval
= 0.
]]]] )$other
[, string $callback
[, string $data
[, string $priority
]]] )$callback
[, mixed $data
= NULL
[, int $priority
= 0
]] )$callback
[, mixed $data
= NULL
[, int $priority
= 0
]] )$fd
, int $events
, callable $callback
[, mixed $data
= NULL
[, int $priority
= 0
]] )$offset
, double $interval
, callable $callback
[, mixed $data
= NULL
[, int $priority
= 0
]] )$callback
[, mixed $data
= NULL
[, int $priority
= 0
]] )$flags
= 0
] )$signum
, callable $callback
[, mixed $data
= NULL
[, int $priority
= 0
]] )$path
, double $interval
, callable $callback
[, mixed $data
= NULL
[, int $priority
= 0
]] )$how
] )$after
, double $repeat
, callable $callback
[, mixed $data
= NULL
[, int $priority
= 0
]] )Custom data attached to loop
Readonly . The backend flags indicating the event backend in use.
Readonly
. TRUE
if it is the default event loop.
The current iteration count of the loop. See Ev::iteration()
The number of pending watchers.
0
indicates that there are no watchers pending.
Higher
io_interval
allows
libev
to spend more time collecting
EvIo
events, so more events can be handled per iteration, at the cost of
increasing latency. Timeouts (both
EvPeriodic
and
EvTimer
) will not be affected. Setting this to a non-zero value will introduce
an additional
sleep()
call into most loop iterations. The sleep time ensures that
libev
will not poll for
EvIo
events more often than once per this interval, on average. Many
programs can usually benefit by setting the
io_interval
to a value near
0.1
, which is often enough for interactive servers(not for games). It
usually doesn't make much sense to set it to a lower value than
0.01
, as this approaches the timing granularity of most systems.
See also » FUNCTIONS CONTROLLING EVENT LOOPS .
Higher timeout_interval allows libev to spend more time collecting timeouts, at the expense of increased latency/jitter/inexactness(the watcher callback will be called later). EvIo watchers will not be affected. Setting this to a non-null value will not introduce any overhead in libev . See also » FUNCTIONS CONTROLLING EVENT LOOPS .
The recursion depth. See Ev::depth() .