Hit | Total | Coverage | |
---|---|---|---|
Lines | 1 | 2 | 50.0% |
Functions | 0 | 0 | - |
Branches | 0 | 0 | - |
Line | Branch | Hits | Source code |
---|---|---|---|
1 | import '../../typedefs.dart'; |
||
2 |
|
||
3 | /// Singleton class used to generate unique IDs for cancelation tokens. |
||
4 | /// |
||
5 | /// The class implements a simple counter that is incremented each time a new |
||
6 | /// ID is requested. Workers should forward the cancelation token they received |
||
7 | /// when calling other workers. |
||
8 | class TokenId { |
||
9 | 0 | TokenId._(); |
|
10 |
|
||
11 | static int _id = 0; |
||
12 |
|
||
13 | /// Provides the next ID. |
||
14 | 10 | static String next() => '${++_id}@$threadId'; |
|
15 | } |