@@ -21,37 +21,37 @@ import Swift
2121extension ExecutorJob {
2222 fileprivate var cooperativeExecutorTimestampIsIndirect : Bool {
2323 return MemoryLayout < ( Int , Int ) > . size
24- < MemoryLayout < CooperativeExecutor . Timestamp > . size
24+ < MemoryLayout < _CooperativeExecutor . Timestamp > . size
2525 }
2626
27- fileprivate var cooperativeExecutorTimestampPointer : UnsafeMutablePointer < CooperativeExecutor . Timestamp > {
27+ fileprivate var cooperativeExecutorTimestampPointer : UnsafeMutablePointer < _CooperativeExecutor . Timestamp > {
2828 get {
2929 assert ( cooperativeExecutorTimestampIsIndirect)
30- return unsafe withUnsafeExecutorPrivateData {
31- unsafe $0. withMemoryRebound ( to: UnsafeMutablePointer< CooperativeExecutor . Timestamp> . self ) {
30+ return unsafe _withUnsafeExecutorPrivateData {
31+ unsafe $0. withMemoryRebound ( to: UnsafeMutablePointer< _CooperativeExecutor . Timestamp> . self ) {
3232 return unsafe $0[ 0 ]
3333 }
3434 }
3535 }
3636 set {
3737 assert ( cooperativeExecutorTimestampIsIndirect)
38- unsafe withUnsafeExecutorPrivateData {
39- unsafe $0. withMemoryRebound ( to: UnsafeMutablePointer< CooperativeExecutor . Timestamp> . self ) {
38+ unsafe _withUnsafeExecutorPrivateData {
39+ unsafe $0. withMemoryRebound ( to: UnsafeMutablePointer< _CooperativeExecutor . Timestamp> . self ) {
4040 unsafe $0[ 0 ] = newValue
4141 }
4242 }
4343 }
4444 }
4545
46- fileprivate var cooperativeExecutorTimestamp : CooperativeExecutor . Timestamp {
46+ fileprivate var cooperativeExecutorTimestamp : _CooperativeExecutor . Timestamp {
4747 get {
4848 if cooperativeExecutorTimestampIsIndirect {
4949 let ptr = unsafe cooperativeExecutorTimestampPointer
5050 return unsafe ptr. pointee
5151 } else {
52- return unsafe withUnsafeExecutorPrivateData {
52+ return unsafe _withUnsafeExecutorPrivateData {
5353 return unsafe $0. assumingMemoryBound (
54- to: CooperativeExecutor . Timestamp. self
54+ to: _CooperativeExecutor . Timestamp. self
5555 ) [ 0 ]
5656 }
5757 }
@@ -61,8 +61,8 @@ extension ExecutorJob {
6161 let ptr = unsafe cooperativeExecutorTimestampPointer
6262 unsafe ptr. pointee = newValue
6363 } else {
64- unsafe withUnsafeExecutorPrivateData {
65- unsafe $0. withMemoryRebound ( to: CooperativeExecutor . Timestamp. self) {
64+ unsafe _withUnsafeExecutorPrivateData {
65+ unsafe $0. withMemoryRebound ( to: _CooperativeExecutor . Timestamp. self) {
6666 unsafe $0[ 0 ] = newValue
6767 }
6868 }
@@ -73,10 +73,10 @@ extension ExecutorJob {
7373 fileprivate mutating func setupCooperativeExecutorTimestamp( ) {
7474 // If a Timestamp won't fit, allocate
7575 if cooperativeExecutorTimestampIsIndirect {
76- let ptr : UnsafeMutablePointer < CooperativeExecutor . Timestamp >
76+ let ptr : UnsafeMutablePointer < _CooperativeExecutor . Timestamp >
7777 // Try to use the task allocator if it has one
7878 if let allocator {
79- unsafe ptr = allocator. allocate ( as: CooperativeExecutor . Timestamp. self)
79+ unsafe ptr = allocator. allocate ( as: _CooperativeExecutor . Timestamp. self)
8080 } else {
8181 unsafe ptr = . allocate( capacity: 1 )
8282 }
@@ -100,7 +100,7 @@ extension ExecutorJob {
100100/// A co-operative executor that can be used as the main executor or as a
101101/// task executor.
102102@available ( SwiftStdlib 6 . 2 , * )
103- class CooperativeExecutor : Executor , @unchecked Sendable {
103+ class _CooperativeExecutor : Executor , @unchecked Sendable {
104104 var runQueue : PriorityQueue < UnownedJob >
105105 var waitQueue : PriorityQueue < UnownedJob >
106106 var shouldStop : Bool = false
@@ -174,13 +174,13 @@ class CooperativeExecutor: Executor, @unchecked Sendable {
174174 runQueue. push ( UnownedJob ( job) )
175175 }
176176
177- public var isMainExecutor : Bool { true }
177+ public var _isMainExecutor : Bool { true }
178178
179- public var asSchedulable : any SchedulableExecutor { self }
179+ public var _asSchedulable : any _SchedulableExecutor { self }
180180}
181181
182182@available ( SwiftStdlib 6 . 2 , * )
183- extension CooperativeExecutor : SchedulableExecutor {
183+ extension _CooperativeExecutor : _SchedulableExecutor {
184184 var currentTime : Timestamp {
185185 var now : Timestamp = . zero
186186 unsafe _getTime ( seconds: & now. seconds,
@@ -189,11 +189,11 @@ extension CooperativeExecutor: SchedulableExecutor {
189189 return now
190190 }
191191
192- public func enqueue < C: Clock > ( _ job: consuming ExecutorJob ,
193- after delay: C . Duration ,
194- tolerance: C . Duration ? = nil ,
195- clock: C ) {
196- let duration = Duration ( from: clock. convert ( from: delay) !)
192+ public func _enqueue < C: Clock > ( _ job: consuming ExecutorJob ,
193+ after delay: C . Duration ,
194+ tolerance: C . Duration ? = nil ,
195+ clock: C ) {
196+ let duration = Duration ( from: clock. _convert ( from: delay) !)
197197 let deadline = self . currentTime + duration
198198
199199 job. setupCooperativeExecutorTimestamp ( )
@@ -203,12 +203,12 @@ extension CooperativeExecutor: SchedulableExecutor {
203203}
204204
205205@available ( SwiftStdlib 6 . 2 , * )
206- extension CooperativeExecutor : RunLoopExecutor {
207- public func run ( ) throws {
208- try runUntil { false }
206+ extension _CooperativeExecutor : _RunLoopExecutor {
207+ public func _run ( ) throws {
208+ try _runUntil { false }
209209 }
210210
211- public func runUntil ( _ condition: ( ) -> Bool ) throws {
211+ public func _runUntil ( _ condition: ( ) -> Bool ) throws {
212212 shouldStop = false
213213 while !shouldStop && !condition( ) {
214214 // Process the timer queue
@@ -244,18 +244,18 @@ extension CooperativeExecutor: RunLoopExecutor {
244244 }
245245 }
246246
247- public func stop ( ) {
247+ public func _stop ( ) {
248248 shouldStop = true
249249 }
250250}
251251
252252@available( SwiftStdlib 6.2 , * )
253- extension CooperativeExecutor : SerialExecutor { }
253+ extension _CooperativeExecutor : SerialExecutor { }
254254
255255@available( SwiftStdlib 6.2 , * )
256- extension CooperativeExecutor : TaskExecutor { }
256+ extension _CooperativeExecutor : TaskExecutor { }
257257
258258@available( SwiftStdlib 6.2 , * )
259- extension CooperativeExecutor : MainExecutor { }
259+ extension _CooperativeExecutor : _MainExecutor { }
260260
261261#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
0 commit comments