-
Notifications
You must be signed in to change notification settings - Fork 2
/
Strand.php
48 lines (41 loc) · 920 Bytes
/
Strand.php
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
<?php
declare(strict_types=1); // @codeCoverageIgnore
namespace Recoil;
/**
* A strand of execution.
*
* The coroutine kernel's equivalent to a thread.
*/
interface Strand extends Listener, AwaitableProvider
{
/**
* Get the strand's ID.
*
* Strand IDs are unique within the kernel.
*/
public function id(): int;
/**
* Permanently stop the strand from executing.
*
* @return null
*/
public function terminate();
/**
* Check if the strand has exited.
*/
public function hasExited(): bool;
/**
* Get the current trace for this strand.
*
* @return StrandTrace|null
*/
public function trace();
/**
* Set the current trace for this strand.
*
* This method has no effect when assertions are disabled.
*
* @return null
*/
public function setTrace(StrandTrace $trace = null);
}