-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFuture.stub
More file actions
54 lines (45 loc) · 1.28 KB
/
Future.stub
File metadata and controls
54 lines (45 loc) · 1.28 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
<?php
namespace parallel;
use Throwable;
/**
* @template T
*/
final class Future
{
/* Resolution */
/**
* Shall return (and if necessary wait for) return from task
*
* @return T
*
* @throws Future\Error if waiting failed (internal error).
* @throws Future\Error\Killed if \parallel\Runtime executing task was killed.
* @throws Future\Error\Cancelled if task was cancelled.
* @throws Future\Error\Foreign if task raised an unrecognized uncaught exception.
* @throws Throwable Shall rethrow \Throwable uncaught in task
*/
public function value() {}
/* State */
/**
* Shall indicate if the task is completed
* @return bool
*/
public function done(): bool {}
/**
* Shall indicate if the task was cancelled
* @return bool
*/
public function cancelled(): bool {}
/* Cancellation */
/**
* Shall try to cancel the task
* Note: If task is running, it will be interrupted.
* Warning: Internal function calls in progress cannot be interrupted.
*
* @return bool
*
* @throws Future\Error\Killed if \parallel\Runtime executing task was killed.
* @throws Future\Error\Cancelled if task was already cancelled.
*/
public function cancel(): bool {}
}