getting SPM working on Linux

This commit is contained in:
gormster 2016-09-19 14:44:11 +10:00 committed by Krunoslav Zaher
parent ddb514c4e9
commit 3023000806
7 changed files with 21 additions and 15 deletions

View File

@ -36,12 +36,6 @@ let package = Package(
Target(
name: "RxSwift"
),
Target(
name: "RxTests",
dependencies: [
.Target(name: "RxSwift")
]
),
Target(
name: "RxBlocking",
dependencies: [
@ -49,7 +43,7 @@ let package = Package(
]
),
Target(
name: "AllTests",
name: "RxSwiftTests",
dependencies: [
.Target(name: "RxSwift"),
.Target(name: "RxBlocking"),
@ -59,6 +53,9 @@ let package = Package(
],
exclude: [
"Sources/RxCocoa",
"Sources/RxTests",
"Sources/AllTests",
"Tests/RxCocoaTests"
]
)
#endif

View File

@ -36,17 +36,17 @@ protocol Lock {
pthread_spin_unlock(&_lock)
}
func performLocked(@noescape action: () -> Void) {
func performLocked(action: () -> Void) {
lock(); defer { unlock() }
action()
}
func calculateLocked<T>(@noescape action: () -> T) -> T {
func calculateLocked<T>(action: () -> T) -> T {
lock(); defer { unlock() }
return action()
}
func calculateLockedOrFail<T>(@noescape action: () throws -> T) throws -> T {
func calculateLockedOrFail<T>(action: () throws -> T) throws -> T {
lock(); defer { unlock() }
let result = try action()
return result

View File

@ -21,7 +21,7 @@ public class Observable<Element> : ObservableType {
init() {
#if TRACE_RESOURCES
OSAtomicIncrement32(&resourceCount)
let _ = AtomicIncrement(&resourceCount)
#endif
}

View File

@ -28,7 +28,7 @@
var runLoopCounter = 0
extension NSThread {
extension Thread {
public var isMainThread: Bool {
return true
}
@ -92,9 +92,9 @@
return false
}
extension NSThread {
extension Thread {
static func setThreadLocalStorageValue<T: AnyObject>(value: T?, forKey key: String) {
let currentThread = NSThread.currentThread()
let currentThread = Thread.currentThread()
var threadDictionary = currentThread.threadDictionary
if let newValue = value {
@ -108,7 +108,7 @@
}
static func getThreadLocalStorageValueForKey<T: AnyObject>(key: String) -> T? {
let currentThread = NSThread.currentThread()
let currentThread = Thread.currentThread()
let threadDictionary = currentThread.threadDictionary
return threadDictionary[key] as? T

View File

@ -7,6 +7,9 @@
//
import Foundation
#if os(Linux)
import Dispatch
#endif
/**
Abstracts the work that needs to be performed on a specific `dispatch_queue_t`. You can also pass a serial dispatch queue, it shouldn't cause any problems.

View File

@ -7,6 +7,9 @@
//
import Foundation
#if os(Linux)
import Dispatch
#endif
struct DispatchQueueConfiguration {
let queue: DispatchQueue

View File

@ -7,6 +7,9 @@
//
import Foundation
#if os(Linux)
import Dispatch
#endif
/**
Abstracts the work that needs to be performed on a specific `dispatch_queue_t`. It will make sure