File tree Expand file tree Collapse file tree 5 files changed +377
-378
lines changed Expand file tree Collapse file tree 5 files changed +377
-378
lines changed Original file line number Diff line number Diff line change 1616
1717import Foundation
1818
19- #if os(Linux)
19+ #if ! os(Linux) || dispatch
2020
21- public typealias DefaultExecutionContext = PThreadExecutionContext
21+ public typealias DefaultExecutionContext = DispatchExecutionContext
2222
2323#else
2424
25- public typealias DefaultExecutionContext = DispatchExecutionContext
25+ public typealias DefaultExecutionContext = PThreadExecutionContext
2626
2727#endif
2828
Original file line number Diff line number Diff line change 1414//limitations under the License.
1515//===----------------------------------------------------------------------===//
1616
17- #if !os(Linux)
17+ #if !os(Linux) || dispatch
1818
1919 import Foundation
2020 import Dispatch
Original file line number Diff line number Diff line change 1717import Foundation
1818import Result
1919
20+ #if !os(Linux) || dispatch
21+ import Dispatch
22+ #endif
23+
2024public typealias Task = ( ) throws -> Void
2125public typealias SafeTask = ( ) -> Void
2226
@@ -163,9 +167,9 @@ public func sleep(timeout:Double) {
163167}
164168
165169@noreturn public func executionContextMain( ) {
166- //#if os(Linux)
170+ #if !os(Linux) || dispatch
171+ dispatch_main ( )
172+ #else
167173 RunLoop . runForever ( )
168- //#else
169- // dispatch_main()
170- //#endif
174+ #endif
171175}
Original file line number Diff line number Diff line change 1515//===----------------------------------------------------------------------===//
1616
1717import Foundation
18- #if os(Linux)
1918import CoreFoundation
20- #endif
2119
22- #if !os(Linux)
20+ #if !os(Linux) || dispatch
2321 import Dispatch
2422
2523 public class DispatchLoopSemaphore : SemaphoreType {
@@ -144,8 +142,8 @@ public class CFRunLoopSemaphore : SemaphoreType {
144142 }
145143}
146144
147- #if os(Linux)
148- public typealias LoopSemaphore = CFRunLoopSemaphore
149- #else
145+ #if !os(Linux) || dispatch
150146 public typealias LoopSemaphore = DispatchLoopSemaphore
147+ #else
148+ public typealias LoopSemaphore = CFRunLoopSemaphore
151149#endif
You can’t perform that action at this time.
0 commit comments