Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
CancellationQueue.php
01 <?php
02
03 namespace React\Promise;
04
05 class CancellationQueue
06 {
07 private $started = false;
08 private $queue = [];
09
10 public function __invoke()
11 {
12 if ($this->started) {
13 return;
14 }
15
16 $this->started = true;
17 $this->drain();
18 }
19
20 public function enqueue($cancellable)
21 {
22 if (!method_exists($cancellable, 'then') || !method_exists($cancellable, 'cancel')) {
23 return;
24 }
25
26 $length = array_push($this->queue, $cancellable);
27
28 if ($this->started && 1 === $length) {
29 $this->drain();
30 }
31 }
32
33 private function drain()
34 {
35 for ($i = key($this->queue); isset($this->queue[$i]); $i++) {
36 $cancellable = $this->queue[$i];
37
38 $exception = null;
39
40 try {
41 $cancellable->cancel();
42 } catch (\Throwable $exception) {
43 } catch (\Exception $exception) {
44 }
45
46 unset($this->queue[$i]);
47
48 if ($exception) {
49 throw $exception;
50 }
51 }
52
53 $this->queue = [];
54 }
55 }
56