Update outdated pods.

This commit is contained in:
Qiu Yuzhou
2017-03-20 21:26:25 +08:00
parent 5f97493f1d
commit 975b544078
209 changed files with 4395 additions and 2293 deletions

View File

@ -6,7 +6,8 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
import struct Foundation.Date
import struct Foundation.TimeInterval
import Dispatch
/// 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

@ -6,7 +6,8 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
import struct Foundation.Date
import struct Foundation.TimeInterval
import Dispatch
/**

View File

@ -6,15 +6,36 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
import class Foundation.NSObject
import protocol Foundation.NSCopying
import class Foundation.Thread
import Dispatch
let CurrentThreadSchedulerKeyInstance = "RxSwift.CurrentThreadScheduler.SchedulerKey"
let CurrentThreadSchedulerQueueKeyInstance = "RxSwift.CurrentThreadScheduler.Queue"
#if os(Linux)
import struct Foundation.pthread_key_t
import func Foundation.pthread_setspecific
import func Foundation.pthread_getspecific
import func Foundation.pthread_key_create
fileprivate enum CurrentThreadSchedulerQueueKey {
fileprivate static let instance = "RxSwift.CurrentThreadScheduler.Queue"
}
#else
fileprivate class CurrentThreadSchedulerQueueKey: NSObject, NSCopying {
static let instance = CurrentThreadSchedulerQueueKey()
private override init() {
super.init()
}
typealias CurrentThreadSchedulerValue = NSString
let CurrentThreadSchedulerValueInstance = "RxSwift.CurrentThreadScheduler.SchedulerKey" as NSString
override var hash: Int {
return 0
}
public func copy(with zone: NSZone? = nil) -> Any {
return self
}
}
#endif
/// Represents an object that schedules units of work on the current thread.
///
@ -27,23 +48,37 @@ public class CurrentThreadScheduler : ImmediateSchedulerType {
/// The singleton instance of the current thread scheduler.
public static let instance = CurrentThreadScheduler()
private static var isScheduleRequiredKey: pthread_key_t = { () -> pthread_key_t in
let key = UnsafeMutablePointer<pthread_key_t>.allocate(capacity: 1)
if pthread_key_create(key, nil) != 0 {
rxFatalError("isScheduleRequired key creation failed")
}
return key.pointee
}()
private static var scheduleInProgressSentinel: UnsafeRawPointer = { () -> UnsafeRawPointer in
return UnsafeRawPointer(UnsafeMutablePointer<Int>.allocate(capacity: 1))
}()
static var queue : ScheduleQueue? {
get {
return Thread.getThreadLocalStorageValueForKey(CurrentThreadSchedulerQueueKeyInstance)
return Thread.getThreadLocalStorageValueForKey(CurrentThreadSchedulerQueueKey.instance)
}
set {
Thread.setThreadLocalStorageValue(newValue, forKey: CurrentThreadSchedulerQueueKeyInstance)
Thread.setThreadLocalStorageValue(newValue, forKey: CurrentThreadSchedulerQueueKey.instance)
}
}
/// Gets a value that indicates whether the caller must call a `schedule` method.
public static fileprivate(set) var isScheduleRequired: Bool {
get {
let value: CurrentThreadSchedulerValue? = Thread.getThreadLocalStorageValueForKey(CurrentThreadSchedulerKeyInstance)
return value == nil
return pthread_getspecific(CurrentThreadScheduler.isScheduleRequiredKey) == nil
}
set(isScheduleRequired) {
Thread.setThreadLocalStorageValue(isScheduleRequired ? nil : CurrentThreadSchedulerValueInstance, forKey: CurrentThreadSchedulerKeyInstance)
if pthread_setspecific(CurrentThreadScheduler.isScheduleRequiredKey, isScheduleRequired ? nil : scheduleInProgressSentinel) != 0 {
rxFatalError("pthread_setspecific failed")
}
}
}

View File

@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
import struct Foundation.Date
/// Provides a virtual time scheduler that uses `Date` for absolute time and `NSTimeInterval` for relative time.
public class HistoricalScheduler : VirtualTimeScheduler<HistoricalSchedulerTimeConverter> {

View File

@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
import struct Foundation.Date
/// Converts historial virtual time into real time.
///

View File

@ -6,10 +6,8 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
/// Represents an object that schedules units of work to run immediately on the current thread.
private class ImmediateScheduler : ImmediateSchedulerType {
private final class ImmediateScheduler : ImmediateSchedulerType {
private let _asyncLock = AsyncLock<AnonymousInvocable>()

View File

@ -6,8 +6,6 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
struct AnonymousInvocable : InvocableType {
private let _action: () -> ()

View File

@ -6,8 +6,8 @@
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
//
import Foundation
import Dispatch
import struct Foundation.TimeInterval
struct DispatchQueueConfiguration {
let queue: DispatchQueue

View File

@ -6,8 +6,6 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
struct InvocableScheduledItem<I: InvocableWithValueType> : InvocableType {
let _invocable: I

View File

@ -6,8 +6,6 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
protocol InvocableType {
func invoke()
}

View File

@ -6,8 +6,6 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
struct ScheduledItem<T>
: ScheduledItemType
, InvocableType {

View File

@ -6,8 +6,6 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
protocol ScheduledItemType
: Cancelable
, InvocableType {

View File

@ -6,7 +6,6 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
import Dispatch
/**

View File

@ -6,7 +6,9 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
import class Foundation.OperationQueue
import class Foundation.BlockOperation
import Dispatch
/// Abstracts the work that needs to be performed on a specific `NSOperationQueue`.
///

View File

@ -6,8 +6,6 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
fileprivate enum ScheduleState {
case initial
case added(CompositeDisposable.DisposeKey)
@ -15,11 +13,11 @@ fileprivate enum ScheduleState {
}
/// Type erased recursive scheduler.
class AnyRecursiveScheduler<State> {
final class AnyRecursiveScheduler<State> {
typealias Action = (State, AnyRecursiveScheduler<State>) -> Void
private let _lock = NSRecursiveLock()
private let _lock = RecursiveLock()
// state
private let _group = CompositeDisposable()
@ -150,7 +148,7 @@ class AnyRecursiveScheduler<State> {
}
/// Type erased recursive scheduler.
class RecursiveImmediateScheduler<State> {
final class RecursiveImmediateScheduler<State> {
typealias Action = (_ state: State, _ recurse: (State) -> Void) -> Void
private var _lock = SpinLock()

View File

@ -6,14 +6,12 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
enum SchedulePeriodicRecursiveCommand {
case tick
case dispatchStart
}
class SchedulePeriodicRecursive<State> {
final class SchedulePeriodicRecursive<State> {
typealias RecursiveAction = (State) -> State
typealias RecursiveScheduler = AnyRecursiveScheduler<SchedulePeriodicRecursiveCommand>

View File

@ -6,7 +6,8 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
import struct Foundation.TimeInterval
import struct Foundation.Date
import Dispatch
/**

View File

@ -6,8 +6,6 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
/// Parametrization for virtual time used by `VirtualTimeScheduler`s.
public protocol VirtualTimeConverterType {
/// Virtual time unit used that represents ticks of virtual clock.

View File

@ -6,8 +6,6 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import Foundation
/// Base class for virtual time schedulers using a priority queue for scheduled items.
open class VirtualTimeScheduler<Converter: VirtualTimeConverterType>
: SchedulerType {
@ -234,7 +232,7 @@ extension VirtualTimeScheduler: CustomDebugStringConvertible {
}
}
class VirtualSchedulerItem<Time>
final class VirtualSchedulerItem<Time>
: Disposable {
typealias Action = () -> Disposable