1 | <?php |
||
12 | class PipeQueue implements QueueInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var Pipe |
||
16 | */ |
||
17 | protected $pipe; |
||
18 | |||
19 | /** |
||
20 | * @var bool |
||
21 | */ |
||
22 | protected $block; |
||
23 | |||
24 | /** |
||
25 | * @param string $filename fifo filename |
||
26 | * @param int $mode |
||
27 | * @param bool $block if blocking |
||
28 | */ |
||
29 | 3 | public function __construct($filename = '/tmp/simple-fork.pipe', $mode = 0666) |
|
35 | |||
36 | /** |
||
37 | * put value into the queue of channel |
||
38 | * |
||
39 | * @param $value |
||
40 | * @return bool |
||
41 | */ |
||
42 | 3 | public function put($value) |
|
53 | |||
54 | /** |
||
55 | * get value from the queue of channel |
||
56 | * |
||
57 | * @param bool $block if block when the queue is empty |
||
58 | * @return bool|string |
||
59 | */ |
||
60 | 3 | public function get($block = false) |
|
93 | |||
94 | /** |
||
95 | * remove the queue resource |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | public function remove() |
||
104 | } |