ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
functions.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\Event\Loop;
4 
12 function setTimeout(callable $cb, $timeout) {
13 
14  instance()->setTimeout($cb, $timeout);
15 
16 }
17 
28 function setInterval(callable $cb, $timeout) {
29 
30  return instance()->setInterval($cb, $timeout);
31 
32 }
33 
40 function clearInterval($intervalId) {
41 
42  instance()->clearInterval($intervalId);
43 
44 }
45 
52 function nextTick(callable $cb) {
53 
54  instance()->nextTick($cb);
55 
56 }
57 
58 
72 function addReadStream($stream, callable $cb) {
73 
74  instance()->addReadStream($stream, $cb);
75 
76 }
77 
91 function addWriteStream($stream, callable $cb) {
92 
93  instance()->addWriteStream($stream, $cb);
94 
95 }
96 
104 
105  instance()->removeReadStream($stream);
106 
107 }
108 
116 
117  instance()->removeWriteStream($stream);
118 
119 }
120 
121 
130 function run() {
131 
132  instance()->run();
133 
134 }
135 
151 function tick($block = false) {
152 
153  return instance()->tick($block);
154 
155 }
156 
162 function stop() {
163 
164  instance()->stop();
165 
166 }
167 
173 function instance(Loop $newLoop = null) {
174 
175  static $loop;
176  if ($newLoop) {
177  $loop = $newLoop;
178  } elseif (!$loop) {
179  $loop = new Loop();
180  }
181  return $loop;
182 
183 }
addWriteStream($stream, callable $cb)
Adds a write stream.
Definition: functions.php:91
removeWriteStream($stream)
Stop watching a stream for writes.
Definition: functions.php:115
stop()
Stops a running eventloop.
Definition: functions.php:162
setTimeout(callable $cb, $timeout)
Executes a function after x seconds.
Definition: functions.php:12
$stream
PHP stream implementation.
run()
Runs the loop.
Definition: functions.php:130
clearInterval($intervalId)
Stops a running internval.
Definition: functions.php:40
removeReadStream($stream)
Stop watching a stream for reads.
Definition: functions.php:103
addReadStream($stream, callable $cb)
Adds a read stream.
Definition: functions.php:72
nextTick(callable $cb)
Runs a function immediately at the next iteration of the loop.
Definition: functions.php:52
instance(Loop $newLoop=null)
Retrieves or sets the global Loop object.
Definition: functions.php:173
setInterval(callable $cb, $timeout)
Executes a function every x seconds.
Definition: functions.php:28
tick($block=false)
Executes all pending events.
Definition: functions.php:151
A simple eventloop implementation.
Definition: Loop.php:18