File tree Expand file tree Collapse file tree 2 files changed +7
-20
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 2 files changed +7
-20
lines changed Original file line number Diff line number Diff line change @@ -18,27 +18,20 @@ import Swift
18
18
/// An asynchronous task (just "Task" hereafter) is the analogue of a thread for
19
19
/// asynchronous functions. All asynchronous functions run as part of some task.
20
20
///
21
+ /// A task can only be interacted with by code running "in" the task,
22
+ /// by invoking the appropriate context sensitive static functions which operate
23
+ /// on the "current" task. Because all such functions are `async` they can only
24
+ /// be invoked as part of an existing task, and therefore are guaranteed to be
25
+ /// effective.
26
+ ///
21
27
/// A task's execution can be seen as a series of periods where the task was
22
28
/// running. Each such period ends at a suspension point or -- finally -- the
23
29
/// completion of the task.
24
30
///
25
31
/// These partial periods towards the task's completion are `PartialAsyncTask`.
26
32
/// Partial tasks are generally not interacted with by end-users directly,
27
33
/// unless implementing a scheduler.
28
- public struct Task {
29
- }
30
-
31
- // ==== Current Task -----------------------------------------------------------
32
-
33
- extension Task {
34
- /// Returns the currently executing `Task`.
35
- ///
36
- /// As invoking this function is only possible from an asynchronous context
37
- /// it is always able to return the current `Task` in which we are currently
38
- /// running.
39
- public static func current( ) async -> Task {
40
- fatalError ( " \( #function) not implemented yet. " ) // TODO: needs a built-in function
41
- }
34
+ public enum Task {
42
35
}
43
36
44
37
// ==== Task Priority ----------------------------------------------------------
Original file line number Diff line number Diff line change @@ -87,9 +87,3 @@ func test_detached_throwing() async -> String {
87
87
print ( " caught: \( error) " )
88
88
}
89
89
}
90
-
91
- // ==== Current Task -----------------------------------------------------------
92
-
93
- func test_current_task( ) async {
94
- _ = await Task . current ( ) // yay, we know "in" what task we're executing
95
- }
You can’t perform that action at this time.
0 commit comments