Skip to content

Commit 31b6ae2

Browse files
authored
Merge pull request #80984 from ktoso/task-names-update
[Concurrency][SE-review update] Task names update
1 parent 1998f41 commit 31b6ae2

13 files changed

+563
-1355
lines changed

Runtimes/Core/Concurrency/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
add_subdirectory(InternalShims)
22

3+
gyb_expand(Task+init.swift.gyb Task+init.swift)
34
gyb_expand(TaskGroup+addTask.swift.gyb TaskGroup+addTask.swift)
45
gyb_expand(Task+immediate.swift.gyb Task+immediate.swift)
56

@@ -92,10 +93,10 @@ add_library(swift_Concurrency
9293
Task+TaskExecutor.swift
9394
TaskCancellation.swift
9495
TaskGroup.swift
95-
TaskGroup+Embedded.swift
9696
TaskLocal.swift
9797
TaskSleep.swift
9898
TaskSleepDuration.swift
99+
"${CMAKE_CURRENT_BINARY_DIR}/Task+init.swift"
99100
"${CMAKE_CURRENT_BINARY_DIR}/TaskGroup+addTask.swift"
100101
"${CMAKE_CURRENT_BINARY_DIR}/Task+immediate.swift")
101102

cmake/modules/SwiftSetIfArchBitness.cmake

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ function(set_if_arch_bitness var_name)
2727
"${SIA_ARCH}" STREQUAL "powerpc")
2828
set("${var_name}" "${SIA_CASE_32_BIT}" PARENT_SCOPE)
2929
elseif("${SIA_ARCH}" STREQUAL "x86_64" OR
30-
"${SIA_ARCH}" STREQUAL "amd64" OR
31-
"${SIA_ARCH}" STREQUAL "arm64" OR
32-
"${SIA_ARCH}" STREQUAL "arm64e" OR
33-
"${SIA_ARCH}" STREQUAL "aarch64" OR
34-
"${SIA_ARCH}" STREQUAL "powerpc64" OR
35-
"${SIA_ARCH}" STREQUAL "powerpc64le" OR
36-
"${SIA_ARCH}" STREQUAL "s390x" OR
37-
"${SIA_ARCH}" STREQUAL "riscv64" OR
38-
"${SIA_ARCH}" STREQUAL "wasm64")
30+
"${SIA_ARCH}" STREQUAL "amd64" OR
31+
"${SIA_ARCH}" STREQUAL "arm64" OR
32+
"${SIA_ARCH}" STREQUAL "arm64e" OR
33+
"${SIA_ARCH}" STREQUAL "aarch64" OR
34+
"${SIA_ARCH}" STREQUAL "powerpc64" OR
35+
"${SIA_ARCH}" STREQUAL "powerpc64le" OR
36+
"${SIA_ARCH}" STREQUAL "s390x" OR
37+
"${SIA_ARCH}" STREQUAL "riscv64" OR
38+
"${SIA_ARCH}" STREQUAL "wasm64")
3939
set("${var_name}" "${SIA_CASE_64_BIT}" PARENT_SCOPE)
4040
else()
4141
message(FATAL_ERROR "Unknown architecture: ${SIA_ARCH}")

stdlib/public/Concurrency/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ set(SWIFT_RUNTIME_CONCURRENCY_SWIFT_SOURCES
129129
Task+TaskExecutor.swift
130130
TaskCancellation.swift
131131
TaskGroup.swift
132-
TaskGroup+Embedded.swift
133132
DiscardingTaskGroup.swift
134133
TaskLocal.swift
135134
TaskSleep.swift
@@ -213,6 +212,10 @@ if((SWIFT_BUILD_CLANG_OVERLAYS
213212
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
214213
set(SWIFT_CONCURRENCY_DEPENDENCIES _Builtin_float)
215214
endif()
215+
set(SWIFT_CONCURRENCY_GYB_SOURCES
216+
Task+init.swift.gyb
217+
TaskGroup+addTask.swift.gyb
218+
Task+immediate.swift.gyb)
216219

217220
add_swift_target_library(swift_Concurrency ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
218221
${SWIFT_RUNTIME_CONCURRENCY_C_SOURCES}
@@ -222,8 +225,7 @@ add_swift_target_library(swift_Concurrency ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} I
222225
${SWIFT_RUNTIME_CONCURRENCY_NONEMBEDDED_SWIFT_SOURCES}
223226

224227
GYB_SOURCES
225-
TaskGroup+addTask.swift.gyb
226-
Task+immediate.swift.gyb
228+
${SWIFT_CONCURRENCY_GYB_SOURCES}
227229

228230
SWIFT_MODULE_DEPENDS ${SWIFT_CONCURRENCY_DEPENDENCIES}
229231
SWIFT_MODULE_DEPENDS_ANDROID Android
@@ -322,6 +324,9 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB AND SWIFT_SHOULD_BUILD_EMBEDDED_CONCURRENC
322324
${SWIFT_RUNTIME_CONCURRENCY_SWIFT_SOURCES}
323325
${SWIFT_RUNTIME_CONCURRENCY_EMBEDDED_SWIFT_SOURCES}
324326

327+
GYB_SOURCES
328+
${SWIFT_CONCURRENCY_GYB_SOURCES}
329+
325330
SWIFT_COMPILE_FLAGS
326331
${extra_swift_compile_flags} -enable-experimental-feature Embedded
327332
-parse-stdlib -DSWIFT_CONCURRENCY_EMBEDDED

stdlib/public/Concurrency/SourceCompatibilityShims.swift

Lines changed: 0 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -87,175 +87,6 @@ extension Task where Success == Never, Failure == Never {
8787
}
8888
}
8989

90-
@available(SwiftStdlib 5.1, *)
91-
extension Task where Failure == Error {
92-
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
93-
@discardableResult
94-
@_alwaysEmitIntoClient
95-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
96-
public static func runDetached(
97-
priority: TaskPriority? = nil,
98-
operation: __owned @Sendable @escaping () async throws -> Success
99-
) -> Task<Success, Failure> {
100-
fatalError("Unavailable in task-to-thread concurrency model")
101-
}
102-
#else
103-
@discardableResult
104-
@_alwaysEmitIntoClient
105-
@available(*, deprecated, message: "`Task.runDetached` was replaced by `Task.detached` and will be removed shortly.")
106-
public static func runDetached(
107-
priority: TaskPriority? = nil,
108-
operation: __owned @Sendable @escaping () async throws -> Success
109-
) -> Task<Success, Failure> {
110-
detached(priority: priority, operation: operation)
111-
}
112-
#endif
113-
}
114-
115-
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
116-
@discardableResult
117-
@available(SwiftStdlib 5.1, *)
118-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
119-
@_alwaysEmitIntoClient
120-
public func detach<T>(
121-
priority: TaskPriority? = nil,
122-
operation: __owned @Sendable @escaping () async -> T
123-
) -> Task<T, Never> {
124-
fatalError("Unavailable in task-to-thread concurrency model")
125-
}
126-
#else
127-
@discardableResult
128-
@available(SwiftStdlib 5.1, *)
129-
@available(*, deprecated, message: "`detach` was replaced by `Task.detached` and will be removed shortly.")
130-
@_alwaysEmitIntoClient
131-
public func detach<T>(
132-
priority: TaskPriority? = nil,
133-
operation: __owned @Sendable @escaping () async -> T
134-
) -> Task<T, Never> {
135-
Task.detached(priority: priority, operation: operation)
136-
}
137-
#endif
138-
139-
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
140-
@discardableResult
141-
@available(SwiftStdlib 5.1, *)
142-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
143-
@_alwaysEmitIntoClient
144-
public func detach<T>(
145-
priority: TaskPriority? = nil,
146-
operation: __owned @Sendable @escaping () async throws -> T
147-
) -> Task<T, Error> {
148-
fatalError("Unavailable in task-to-thread concurrency model")
149-
}
150-
#else
151-
@discardableResult
152-
@available(SwiftStdlib 5.1, *)
153-
@available(*, deprecated, message: "`detach` was replaced by `Task.detached` and will be removed shortly.")
154-
@_alwaysEmitIntoClient
155-
public func detach<T>(
156-
priority: TaskPriority? = nil,
157-
operation: __owned @Sendable @escaping () async throws -> T
158-
) -> Task<T, Error> {
159-
Task.detached(priority: priority, operation: operation)
160-
}
161-
#endif
162-
163-
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
164-
@discardableResult
165-
@available(SwiftStdlib 5.1, *)
166-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
167-
@_alwaysEmitIntoClient
168-
public func asyncDetached<T>(
169-
priority: TaskPriority? = nil,
170-
@_implicitSelfCapture operation: __owned @Sendable @escaping () async -> T
171-
) -> Task<T, Never> {
172-
fatalError("Unavailable in task-to-thread concurrency model")
173-
}
174-
#else
175-
@discardableResult
176-
@available(SwiftStdlib 5.1, *)
177-
@available(*, deprecated, message: "`asyncDetached` was replaced by `Task.detached` and will be removed shortly.")
178-
@_alwaysEmitIntoClient
179-
public func asyncDetached<T>(
180-
priority: TaskPriority? = nil,
181-
@_implicitSelfCapture operation: __owned @Sendable @escaping () async -> T
182-
) -> Task<T, Never> {
183-
return Task.detached(priority: priority, operation: operation)
184-
}
185-
#endif
186-
187-
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
188-
@discardableResult
189-
@available(SwiftStdlib 5.1, *)
190-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
191-
@_alwaysEmitIntoClient
192-
public func asyncDetached<T>(
193-
priority: TaskPriority? = nil,
194-
@_implicitSelfCapture operation: __owned @Sendable @escaping () async throws -> T
195-
) -> Task<T, Error> {
196-
fatalError("Unavailable in task-to-thread concurrency model")
197-
}
198-
#else
199-
@discardableResult
200-
@available(SwiftStdlib 5.1, *)
201-
@available(*, deprecated, message: "`asyncDetached` was replaced by `Task.detached` and will be removed shortly.")
202-
@_alwaysEmitIntoClient
203-
public func asyncDetached<T>(
204-
priority: TaskPriority? = nil,
205-
@_implicitSelfCapture operation: __owned @Sendable @escaping () async throws -> T
206-
) -> Task<T, Error> {
207-
return Task.detached(priority: priority, operation: operation)
208-
}
209-
#endif
210-
211-
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
212-
@available(SwiftStdlib 5.1, *)
213-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
214-
@discardableResult
215-
@_alwaysEmitIntoClient
216-
public func async<T>(
217-
priority: TaskPriority? = nil,
218-
@_inheritActorContext @_implicitSelfCapture operation: __owned @Sendable @escaping () async -> T
219-
) -> Task<T, Never> {
220-
fatalError("Unavailable in task-to-thread concurrency model")
221-
}
222-
#else
223-
@available(SwiftStdlib 5.1, *)
224-
@available(*, deprecated, message: "`async` was replaced by `Task.init` and will be removed shortly.")
225-
@discardableResult
226-
@_alwaysEmitIntoClient
227-
public func async<T>(
228-
priority: TaskPriority? = nil,
229-
@_inheritActorContext @_implicitSelfCapture operation: __owned @Sendable @escaping () async -> T
230-
) -> Task<T, Never> {
231-
.init(priority: priority, operation: operation)
232-
}
233-
#endif
234-
235-
#if SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
236-
@available(SwiftStdlib 5.1, *)
237-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
238-
@discardableResult
239-
@_alwaysEmitIntoClient
240-
public func async<T>(
241-
priority: TaskPriority? = nil,
242-
@_inheritActorContext @_implicitSelfCapture operation: __owned @Sendable @escaping () async throws -> T
243-
) -> Task<T, Error> {
244-
fatalError("Unavailable in task-to-thread concurrency model")
245-
}
246-
#else
247-
@available(SwiftStdlib 5.1, *)
248-
@available(*, deprecated, message: "`async` was replaced by `Task.init` and will be removed shortly.")
249-
@discardableResult
250-
@_alwaysEmitIntoClient
251-
public func async<T>(
252-
priority: TaskPriority? = nil,
253-
@_inheritActorContext @_implicitSelfCapture operation: __owned @Sendable @escaping () async throws -> T
254-
) -> Task<T, Error> {
255-
.init(priority: priority, operation: operation)
256-
}
257-
#endif
258-
25990
@available(SwiftStdlib 5.1, *)
26091
extension Task where Success == Never, Failure == Never {
26192
@available(*, deprecated, message: "`Task.Group` was replaced by `ThrowingTaskGroup` and `TaskGroup` and will be removed shortly.")

0 commit comments

Comments
 (0)