Skip to content

Commit 9026ead

Browse files
committed
Merge pull request #14 from crossroadlabs/develop
Develop
2 parents 214bec2 + 4137541 commit 9026ead

File tree

5 files changed

+377
-378
lines changed

5 files changed

+377
-378
lines changed

ExecutionContext/DefaultExecutionContext.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
import 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

ExecutionContext/DispatchExecutionContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//limitations under the License.
1515
//===----------------------------------------------------------------------===//
1616

17-
#if !os(Linux)
17+
#if !os(Linux) || dispatch
1818

1919
import Foundation
2020
import Dispatch

ExecutionContext/ExecutionContext.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
import Foundation
1818
import Result
1919

20+
#if !os(Linux) || dispatch
21+
import Dispatch
22+
#endif
23+
2024
public typealias Task = () throws -> Void
2125
public 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
}

ExecutionContext/LoopSemaphore.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
//===----------------------------------------------------------------------===//
1616

1717
import Foundation
18-
#if os(Linux)
1918
import 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

0 commit comments

Comments
 (0)