Skip to content

Commit 4c65c33

Browse files
authored
Merge pull request #64211 from kavon/assumeOn-task2thread-guarding
guard assume on executor API against task-to-thread runtimes
2 parents 4f59fe8 + c100fe0 commit 4c65c33

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

stdlib/public/Concurrency/Actor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,7 +1905,9 @@ static void swift_task_enqueueImpl(Job *job, ExecutorRef executor) {
19051905
static void
19061906
swift_actor_escalate(DefaultActorImpl *actor, AsyncTask *task, JobPriority newPriority)
19071907
{
1908+
#if !SWIFT_CONCURRENCY_ACTORS_AS_LOCKS
19081909
return actor->enqueueStealer(task, newPriority);
1910+
#endif
19091911
}
19101912

19111913
SWIFT_CC(swift)

stdlib/public/Concurrency/ExecutorAssertions.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import Swift
1414
import SwiftShims
1515

16+
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
1617
// ==== -----------------------------------------------------------------------
1718
// MARK: Precondition executors
1819

@@ -244,4 +245,5 @@ func assumeOnActorExecutor<Act: Actor, T>(
244245
}
245246
}
246247

247-
// TODO(ktoso): implement assume for distributed actors as well
248+
// TODO(ktoso): implement assume for distributed actors as well
249+
#endif // not SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY

stdlib/public/Concurrency/Task.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ extension Task: Equatable {
186186
}
187187
}
188188

189+
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
189190
@available(SwiftStdlib 5.9, *)
190191
extension Task where Failure == Error {
191192
@_spi(MainActorUtilities)
@@ -204,7 +205,9 @@ extension Task where Failure == Error {
204205
return Task<Success, Error>(task)
205206
}
206207
}
208+
#endif
207209

210+
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
208211
@available(SwiftStdlib 5.9, *)
209212
extension Task where Failure == Never {
210213
@_spi(MainActorUtilities)
@@ -223,6 +226,7 @@ extension Task where Failure == Never {
223226
return Task(task)
224227
}
225228
}
229+
#endif
226230

227231
// ==== Task Priority ----------------------------------------------------------
228232

0 commit comments

Comments
 (0)