Commit Graph

15 Commits

Author SHA1 Message Date
Nate Chandler
c9d86eed75 [Freestanding] Disable child task priority spec.
Under the task-to-thread model, specifying a priority doesn't make
sense.

Here, variations of addTask and addTaskUnlessCancelled are introduced
which do not take a priority.  Additionally, the original functions are
made unavailable.
2022-10-18 11:25:10 -07:00
Konrad `ktoso` Malawski
ecccce6113 [Concurrency] Deprecate one of the cancellation handler overloads (#60569) 2022-08-18 11:14:30 +09:00
Nate Chandler
68eea8adec [TaskToThread] No unstructured tasks.
In this mode, the following are disabled:

- task creation
- global actors
- MainActor
- custom executors
2022-07-06 11:51:16 -07:00
Berik Visschers
7fb3624ee7 Fix typo UnsafeContination -> UnsafeContinuation 2021-12-04 01:35:10 +01:00
Karoy Lorentey
47956908b7 [Concurrency] SwiftStdlib 5.5 ⟹ SwiftStdlib 5.1 (usages)
The concurrency runtime now deploys back to macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, which corresponds to the 5.1 release of the stdlib.

Adjust macro usages accordingly.
2021-10-28 14:36:36 -07:00
Doug Gregor
4a63884026 Add missing Sendable requirements and a conformance 2021-08-26 10:56:48 -07:00
Doug Gregor
8884e3a510 [SE-0304] Rename Task.suspend() back to Task.yield(). 2021-07-27 12:19:55 -07:00
Doug Gregor
04dd840ba3 [SE-0304] Replace the async operations in (Throwing)TaskGroup with addTask 2021-07-07 17:04:52 -07:00
Ben Rimmington
d3d87e8447 [Concurrency] Deprecate typealias PartialAsyncTask (#38042)
Deprecate typealias PartialAsyncTask, and move it into the "SourceCompatibilityShims.swift" file.
2021-06-23 21:16:17 +01:00
Subhodip Banerjee
80e2d9a81a [Fix] Void Inside SourceCompatibilityShims.swift file. 2021-05-31 08:53:35 +05:30
Doug Gregor
7d2ce77e4d [Concurrency] Add async properties Task.value and Task.result 2021-05-18 20:03:26 -07:00
Doug Gregor
72d8197ce7 Update task cancellation API based on review feedback
Swap the order of the arguments so we now have:

    await withTaskCancellationHandler {
      // do stuff
    } onCancel: {
      // ..
    }
2021-05-18 17:46:43 -07:00
Doug Gregor
8750f209fc [Concurrency] Rename TaskPriority members.
Based on feedback from the second review, we decided to go with
high/default/low/background, with aliases for the Dispatch-inspired
names. While here, make TaskPriority be backed by a UInt8 to better
describe the actual restrictions, and start removing userInteractive,
because clients shouldn't be able to specify it.
2021-05-18 16:37:40 -07:00
Doug Gregor
fdee0ff0ab Move CancellationError out to the top level 2021-05-18 14:36:21 -07:00
Doug Gregor
eda5b4daad [Concurrency] Alternative Task API.
The `Task` type has oscillated somewhat from being purely a namespace,
to having instances that are used (albeit rarely), back to purely
being a namespace that isn't used for all that many names. Many of the
names that used to be on Task have already been moved out, e.g., for
creating new detached tasks, creating new task groups, adding
cancellation handlers, etc.

Collapse `Task.Handle<Success, Failure>` into `Task<Success, Failure>`.
`Task.Handle` is the type that is most frequently referenced in the
concurrency library, so giving it the short name `Task` is most
appropriate. Replace the top-level async/detach functions with a
`Task` initializer and `Task.detached`, respectively.

The `Task` type can still act as a namespace for static operations
such as, e.g., `Task.isCancelled`. Do this with an extension of the
form:

    extension Task where Success == Never, Failure == Never { ... }

We've been accruing a number of compatibility shims. Move them all
into their own source file, deprecate them, and make them
always-emit-into-client so they don't have any ABI impact.
2021-05-18 14:36:21 -07:00