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
1818/// An asynchronous task (just "Task" hereafter) is the analogue of a thread for
1919/// asynchronous functions. All asynchronous functions run as part of some task.
2020///
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+ ///
2127/// A task's execution can be seen as a series of periods where the task was
2228/// running. Each such period ends at a suspension point or -- finally -- the
2329/// completion of the task.
2430///
2531/// These partial periods towards the task's completion are `PartialAsyncTask`.
2632/// Partial tasks are generally not interacted with by end-users directly,
2733/// 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 {
4235}
4336
4437// ==== Task Priority ----------------------------------------------------------
Original file line number Diff line number Diff line change @@ -87,9 +87,3 @@ func test_detached_throwing() async -> String {
8787 print ( " caught: \( error) " )
8888 }
8989}
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