mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Split distributed_actor_custom_executor_availability.swift into two tests, one that only runs on existing platforms that support back deployment to Swift 5.7 aligned runtimes, and another test that is not restricted by platform that tests behavior when deploying to a Swift 5.9 aligned runtime or later.
63 lines
1.5 KiB
Swift
63 lines
1.5 KiB
Swift
import Distributed
|
|
import FakeDistributedActorSystems
|
|
|
|
@available(SwiftStdlib 5.7, *)
|
|
typealias DefaultDistributedActorSystem = LocalTestingDistributedActorSystem
|
|
|
|
@available(SwiftStdlib 5.7, *)
|
|
distributed actor FiveSevenActor_NothingExecutor {
|
|
nonisolated var unownedExecutor: UnownedSerialExecutor {
|
|
print("get unowned executor")
|
|
return MainActor.sharedUnownedExecutor
|
|
}
|
|
|
|
@available(SwiftStdlib 5.9, *)
|
|
distributed func test(x: Int) throws {
|
|
print("executed: \(#function)")
|
|
defer {
|
|
print("done executed: \(#function)")
|
|
}
|
|
MainActor.assumeIsolated {
|
|
// ignore
|
|
}
|
|
}
|
|
}
|
|
|
|
@available(SwiftStdlib 5.9, *)
|
|
distributed actor FiveNineActor_NothingExecutor {
|
|
nonisolated var unownedExecutor: UnownedSerialExecutor {
|
|
print("get unowned executor")
|
|
return MainActor.sharedUnownedExecutor
|
|
}
|
|
|
|
distributed func test(x: Int) throws {
|
|
print("executed: \(#function)")
|
|
defer {
|
|
print("done executed: \(#function)")
|
|
}
|
|
MainActor.assumeIsolated {
|
|
// ignore
|
|
}
|
|
}
|
|
}
|
|
|
|
@available(SwiftStdlib 5.7, *)
|
|
distributed actor FiveSevenActor_FiveNineExecutor {
|
|
@available(SwiftStdlib 5.9, *)
|
|
nonisolated var unownedExecutor: UnownedSerialExecutor {
|
|
print("get unowned executor")
|
|
return MainActor.sharedUnownedExecutor
|
|
}
|
|
|
|
@available(SwiftStdlib 5.9, *)
|
|
distributed func test(x: Int) throws {
|
|
print("executed: \(#function)")
|
|
defer {
|
|
print("done executed: \(#function)")
|
|
}
|
|
MainActor.assumeIsolated {
|
|
// ignore
|
|
}
|
|
}
|
|
}
|