Skip to content

[Concurrency] remove unimplemented Task APIs: yield, startingOn #36244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stdlib/public/Concurrency/Executor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@

import Swift

// TODO: just a placeholder; proposal and complete types soon
public protocol ExecutorRef {}
// TODO: Custom Executors proposal will define these types
// https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425/38
22 changes: 0 additions & 22 deletions stdlib/public/Concurrency/Task.swift
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,9 @@ extension Task {
@discardableResult
public static func runDetached<T>(
priority: Priority = .default,
startingOn executor: ExecutorRef? = nil,
operation: @concurrent @escaping () async -> T
// TODO: Allow inheriting task-locals?
) -> Handle<T, Never> {
assert(executor == nil, "Custom executor support is not implemented yet.") // FIXME

// Set up the job flags for a new task.
var flags = JobFlags()
flags.kind = .task
Expand Down Expand Up @@ -448,11 +445,8 @@ extension Task {
@discardableResult
public static func runDetached<T, Failure>(
priority: Priority = .default,
startingOn executor: ExecutorRef? = nil,
operation: @concurrent @escaping () async throws -> T
) -> Handle<T, Failure> {
assert(executor == nil, "Custom executor support is not implemented yet.") // FIXME

// Set up the job flags for a new task.
var flags = JobFlags()
flags.kind = .task
Expand All @@ -478,22 +472,6 @@ public func _runAsyncHandler(operation: @escaping () async -> ()) {
)
}

// ==== Voluntary Suspension -----------------------------------------------------

extension Task {

/// Explicitly suspend the current task, potentially giving up execution actor
/// of current actor/task, allowing other tasks to execute.
///
/// This is not a perfect cure for starvation;
/// if the task is the highest-priority task in the system, it might go
/// immediately back to executing.
@available(*, deprecated, message: "Not implemented yet.")
public static func yield() async {
fatalError("\(#function) not implemented yet.")
}
}

// ==== UnsafeCurrentTask ------------------------------------------------------

extension Task {
Expand Down