-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChannel.stub
More file actions
82 lines (69 loc) · 1.92 KB
/
Channel.stub
File metadata and controls
82 lines (69 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
namespace parallel;
/**
* @template T
*/
final class Channel
{
/**
* Constant for Infinitely Buffered
*/
public const Infinite = -1;
/* Anonymous Constructor */
/**
* Shall make an anonymous unbuffered channel
* Shall make an anonymous buffered channel with the given capacity
*
* @param null|int $capacity May be Channel::Infinite or a positive integer
*/
public function __construct(?int $capacity = null) {}
/* Access */
/**
* Shall make an unbuffered channel with the given name
* Shall make a buffered channel with the given name and capacity
*
* @param string $name The name of the channel.
* @param null|int $capacity May be Channel::Infinite or a positive integer
*
* @return Channel<T>
*
* @throws Channel\Error\Existence if channel already exists.
*/
public static function make(string $name, ?int $capacity = null): Channel {}
/**
* Shall open the channel with the given name
*
* @param string $name
* @return Channel<T>
*
* @throws Channel\Error\Existence if channel does not exist.
*/
public static function open(string $name): Channel {}
/* Sharing */
/**
* Shall send the given value on this channel
* @param T $value
*
* @throws Channel\Error\Closed if channel is closed.
* @throws Channel\Error\IllegalValue if value is illegal.
*/
public function send($value): void {}
/**
* Shall recv a value from this channel
* @return T
*
* @throws Channel\Error\Closed if channel is closed.
*/
public function recv() {}
/* Closing */
/**
* Shall close this channel
* @throws Channel\Error\Closed if channel is closed.
*/
public function close(): void {}
/**
* Returns name of channel
* @return string
*/
public function __toString(): string {}
}