Skip to content

[Concurrency][SE-review update] Task names update #80984

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 4 commits into from
May 27, 2025
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
3 changes: 2 additions & 1 deletion Runtimes/Core/Concurrency/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
add_subdirectory(InternalShims)

gyb_expand(Task+init.swift.gyb Task+init.swift)
gyb_expand(TaskGroup+addTask.swift.gyb TaskGroup+addTask.swift)
gyb_expand(Task+immediate.swift.gyb Task+immediate.swift)

Expand Down Expand Up @@ -92,10 +93,10 @@ add_library(swift_Concurrency
Task+TaskExecutor.swift
TaskCancellation.swift
TaskGroup.swift
TaskGroup+Embedded.swift
TaskLocal.swift
TaskSleep.swift
TaskSleepDuration.swift
"${CMAKE_CURRENT_BINARY_DIR}/Task+init.swift"
"${CMAKE_CURRENT_BINARY_DIR}/TaskGroup+addTask.swift"
"${CMAKE_CURRENT_BINARY_DIR}/Task+immediate.swift")

Expand Down
18 changes: 9 additions & 9 deletions cmake/modules/SwiftSetIfArchBitness.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ function(set_if_arch_bitness var_name)
"${SIA_ARCH}" STREQUAL "powerpc")
set("${var_name}" "${SIA_CASE_32_BIT}" PARENT_SCOPE)
elseif("${SIA_ARCH}" STREQUAL "x86_64" OR
"${SIA_ARCH}" STREQUAL "amd64" OR
"${SIA_ARCH}" STREQUAL "arm64" OR
"${SIA_ARCH}" STREQUAL "arm64e" OR
"${SIA_ARCH}" STREQUAL "aarch64" OR
"${SIA_ARCH}" STREQUAL "powerpc64" OR
"${SIA_ARCH}" STREQUAL "powerpc64le" OR
"${SIA_ARCH}" STREQUAL "s390x" OR
"${SIA_ARCH}" STREQUAL "riscv64" OR
"${SIA_ARCH}" STREQUAL "wasm64")
"${SIA_ARCH}" STREQUAL "amd64" OR
"${SIA_ARCH}" STREQUAL "arm64" OR
"${SIA_ARCH}" STREQUAL "arm64e" OR
"${SIA_ARCH}" STREQUAL "aarch64" OR
"${SIA_ARCH}" STREQUAL "powerpc64" OR
"${SIA_ARCH}" STREQUAL "powerpc64le" OR
"${SIA_ARCH}" STREQUAL "s390x" OR
"${SIA_ARCH}" STREQUAL "riscv64" OR
"${SIA_ARCH}" STREQUAL "wasm64")
set("${var_name}" "${SIA_CASE_64_BIT}" PARENT_SCOPE)
else()
message(FATAL_ERROR "Unknown architecture: ${SIA_ARCH}")
Expand Down
11 changes: 8 additions & 3 deletions stdlib/public/Concurrency/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ set(SWIFT_RUNTIME_CONCURRENCY_SWIFT_SOURCES
Task+TaskExecutor.swift
TaskCancellation.swift
TaskGroup.swift
TaskGroup+Embedded.swift
DiscardingTaskGroup.swift
TaskLocal.swift
TaskSleep.swift
Expand Down Expand Up @@ -213,6 +212,10 @@ if((SWIFT_BUILD_CLANG_OVERLAYS
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
set(SWIFT_CONCURRENCY_DEPENDENCIES _Builtin_float)
endif()
set(SWIFT_CONCURRENCY_GYB_SOURCES
Task+init.swift.gyb
TaskGroup+addTask.swift.gyb
Task+immediate.swift.gyb)

add_swift_target_library(swift_Concurrency ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
${SWIFT_RUNTIME_CONCURRENCY_C_SOURCES}
Expand All @@ -222,8 +225,7 @@ add_swift_target_library(swift_Concurrency ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} I
${SWIFT_RUNTIME_CONCURRENCY_NONEMBEDDED_SWIFT_SOURCES}

GYB_SOURCES
TaskGroup+addTask.swift.gyb
Task+immediate.swift.gyb
${SWIFT_CONCURRENCY_GYB_SOURCES}

SWIFT_MODULE_DEPENDS ${SWIFT_CONCURRENCY_DEPENDENCIES}
SWIFT_MODULE_DEPENDS_ANDROID Android
Expand Down Expand Up @@ -322,6 +324,9 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB AND SWIFT_SHOULD_BUILD_EMBEDDED_CONCURRENC
${SWIFT_RUNTIME_CONCURRENCY_SWIFT_SOURCES}
${SWIFT_RUNTIME_CONCURRENCY_EMBEDDED_SWIFT_SOURCES}

GYB_SOURCES
${SWIFT_CONCURRENCY_GYB_SOURCES}

SWIFT_COMPILE_FLAGS
${extra_swift_compile_flags} -enable-experimental-feature Embedded
-parse-stdlib -DSWIFT_CONCURRENCY_EMBEDDED
Expand Down
169 changes: 0 additions & 169 deletions stdlib/public/Concurrency/SourceCompatibilityShims.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,175 +87,6 @@ extension Task where Success == Never, Failure == Never {
}
}

@available(SwiftStdlib 5.1, *)
extension Task where Failure == Error {
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
@discardableResult
@_alwaysEmitIntoClient
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
public static func runDetached(
priority: TaskPriority? = nil,
operation: __owned @Sendable @escaping () async throws -> Success
) -> Task<Success, Failure> {
fatalError("Unavailable in task-to-thread concurrency model")
}
#else
@discardableResult
@_alwaysEmitIntoClient
@available(*, deprecated, message: "`Task.runDetached` was replaced by `Task.detached` and will be removed shortly.")
public static func runDetached(
priority: TaskPriority? = nil,
operation: __owned @Sendable @escaping () async throws -> Success
) -> Task<Success, Failure> {
detached(priority: priority, operation: operation)
}
#endif
}

#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
@discardableResult
@available(SwiftStdlib 5.1, *)
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
@_alwaysEmitIntoClient
public func detach<T>(
priority: TaskPriority? = nil,
operation: __owned @Sendable @escaping () async -> T
) -> Task<T, Never> {
fatalError("Unavailable in task-to-thread concurrency model")
}
#else
@discardableResult
@available(SwiftStdlib 5.1, *)
@available(*, deprecated, message: "`detach` was replaced by `Task.detached` and will be removed shortly.")
@_alwaysEmitIntoClient
public func detach<T>(
priority: TaskPriority? = nil,
operation: __owned @Sendable @escaping () async -> T
) -> Task<T, Never> {
Task.detached(priority: priority, operation: operation)
}
#endif

#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
@discardableResult
@available(SwiftStdlib 5.1, *)
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
@_alwaysEmitIntoClient
public func detach<T>(
priority: TaskPriority? = nil,
operation: __owned @Sendable @escaping () async throws -> T
) -> Task<T, Error> {
fatalError("Unavailable in task-to-thread concurrency model")
}
#else
@discardableResult
@available(SwiftStdlib 5.1, *)
@available(*, deprecated, message: "`detach` was replaced by `Task.detached` and will be removed shortly.")
@_alwaysEmitIntoClient
public func detach<T>(
priority: TaskPriority? = nil,
operation: __owned @Sendable @escaping () async throws -> T
) -> Task<T, Error> {
Task.detached(priority: priority, operation: operation)
}
#endif

#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
@discardableResult
@available(SwiftStdlib 5.1, *)
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
@_alwaysEmitIntoClient
public func asyncDetached<T>(
priority: TaskPriority? = nil,
@_implicitSelfCapture operation: __owned @Sendable @escaping () async -> T
) -> Task<T, Never> {
fatalError("Unavailable in task-to-thread concurrency model")
}
#else
@discardableResult
@available(SwiftStdlib 5.1, *)
@available(*, deprecated, message: "`asyncDetached` was replaced by `Task.detached` and will be removed shortly.")
@_alwaysEmitIntoClient
public func asyncDetached<T>(
priority: TaskPriority? = nil,
@_implicitSelfCapture operation: __owned @Sendable @escaping () async -> T
) -> Task<T, Never> {
return Task.detached(priority: priority, operation: operation)
}
#endif

#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
@discardableResult
@available(SwiftStdlib 5.1, *)
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
@_alwaysEmitIntoClient
public func asyncDetached<T>(
priority: TaskPriority? = nil,
@_implicitSelfCapture operation: __owned @Sendable @escaping () async throws -> T
) -> Task<T, Error> {
fatalError("Unavailable in task-to-thread concurrency model")
}
#else
@discardableResult
@available(SwiftStdlib 5.1, *)
@available(*, deprecated, message: "`asyncDetached` was replaced by `Task.detached` and will be removed shortly.")
@_alwaysEmitIntoClient
public func asyncDetached<T>(
priority: TaskPriority? = nil,
@_implicitSelfCapture operation: __owned @Sendable @escaping () async throws -> T
) -> Task<T, Error> {
return Task.detached(priority: priority, operation: operation)
}
#endif

#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
@available(SwiftStdlib 5.1, *)
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
@discardableResult
@_alwaysEmitIntoClient
public func async<T>(
priority: TaskPriority? = nil,
@_inheritActorContext @_implicitSelfCapture operation: __owned @Sendable @escaping () async -> T
) -> Task<T, Never> {
fatalError("Unavailable in task-to-thread concurrency model")
}
#else
@available(SwiftStdlib 5.1, *)
@available(*, deprecated, message: "`async` was replaced by `Task.init` and will be removed shortly.")
@discardableResult
@_alwaysEmitIntoClient
public func async<T>(
priority: TaskPriority? = nil,
@_inheritActorContext @_implicitSelfCapture operation: __owned @Sendable @escaping () async -> T
) -> Task<T, Never> {
.init(priority: priority, operation: operation)
}
#endif

#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
@available(SwiftStdlib 5.1, *)
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
@discardableResult
@_alwaysEmitIntoClient
public func async<T>(
priority: TaskPriority? = nil,
@_inheritActorContext @_implicitSelfCapture operation: __owned @Sendable @escaping () async throws -> T
) -> Task<T, Error> {
fatalError("Unavailable in task-to-thread concurrency model")
}
#else
@available(SwiftStdlib 5.1, *)
@available(*, deprecated, message: "`async` was replaced by `Task.init` and will be removed shortly.")
@discardableResult
@_alwaysEmitIntoClient
public func async<T>(
priority: TaskPriority? = nil,
@_inheritActorContext @_implicitSelfCapture operation: __owned @Sendable @escaping () async throws -> T
) -> Task<T, Error> {
.init(priority: priority, operation: operation)
}
#endif

@available(SwiftStdlib 5.1, *)
extension Task where Success == Never, Failure == Never {
@available(*, deprecated, message: "`Task.Group` was replaced by `ThrowingTaskGroup` and `TaskGroup` and will be removed shortly.")
Expand Down
Loading