0001    //
0002    //  Platform.Darwin.swift
0003    //  Rx
0004    //
0005    //  Created by Krunoslav Zaher on 12/29/15.
0006    //  Copyright © 2015 Krunoslav Zaher. All rights reserved.
0007    //
0008    
0009    #if os(OSX) || os(iOS) || os(tvOS) || os(watchOS)
0010    
0011        import Darwin
0012        import Foundation
0013    
0014        #if TRACE_RESOURCES
0015        public typealias AtomicInt = Int32
0016        #else
0017        typealias AtomicInt
AnonymousDisposable.swift:19
    private var _disposed: AtomicInt = 0
AnonymousObservable.swift:16
    private var _isStopped: AtomicInt = 0
BinaryDisposable.swift:16
    private var _disposed: AtomicInt = 0
MainScheduler.swift:25
    var numberEnqueued: AtomicInt = 0
ObserverBase.swift:14
    private var _isStopped: AtomicInt = 0
RefCountDisposable.swift:115
    private var _disposed: AtomicInt = 0
ScheduledDisposable.swift:22
    private var _disposed: AtomicInt = 0
SchedulerServices+Emulation.swift:26
    private var _pendingTickCount: AtomicInt = 0
= Int32 0018 #endif 0019 0020 let AtomicCompareAndSwap
AnonymousDisposable.swift:47
        if AtomicCompareAndSwap(0, 1, &_disposed) {
AnonymousObservable.swift:30
            if AtomicCompareAndSwap(0, 1, &_isStopped) {
BinaryDisposable.swift:49
        if AtomicCompareAndSwap(0, 1, &_disposed) {
ObserverBase.swift:24
            if !AtomicCompareAndSwap(0, 1, &_isStopped) {
RefCountDisposable.swift:125
        if AtomicCompareAndSwap(0, 1, &_disposed) {
ScheduledDisposable.swift:55
        if AtomicCompareAndSwap(0, 1, &_disposed) {
= OSAtomicCompareAndSwap32 0021 let AtomicIncrement
MainScheduler.swift:47
        let currentNumberEnqueued = AtomicIncrement(&numberEnqueued)
SchedulerServices+Emulation.swift:50
            if AtomicIncrement(&_pendingTickCount) == 1 {
= OSAtomicIncrement32 0022 let AtomicDecrement
MainScheduler.swift:51
            AtomicDecrement(&numberEnqueued)
MainScheduler.swift:62
            AtomicDecrement(&self.numberEnqueued)
SchedulerServices+Emulation.swift:57
            if AtomicDecrement(&_pendingTickCount) > 0 {
= OSAtomicDecrement32 0023 0024 extension NSThread { 0025 static func setThreadLocalStorageValue
CurrentThreadScheduler.swift:77
            NSThread.setThreadLocalStorageValue(newValue, forKey: CurrentThreadSchedulerQueueKeyInstance)
CurrentThreadScheduler.swift:90
            NSThread.setThreadLocalStorageValue(isScheduleRequired ? nil : CurrentThreadSchedulerValueInstance, forKey: CurrentThreadSchedulerKeyInstance)
<T: AnyObject>(value: T?, forKey key: protocol<AnyObject, NSCopying>) { 0026 let currentThread = NSThread.currentThread() 0027 let threadDictionary = currentThread.threadDictionary 0028 0029 if let newValue = value { 0030 threadDictionary.setObject(newValue, forKey: key) 0031 } 0032 else { 0033 threadDictionary.removeObjectForKey(key) 0034 } 0035 0036 } 0037 static func getThreadLocalStorageValueForKey
CurrentThreadScheduler.swift:74
            return NSThread.getThreadLocalStorageValueForKey(CurrentThreadSchedulerQueueKeyInstance)
CurrentThreadScheduler.swift:86
            let value: CurrentThreadSchedulerValue? = NSThread.getThreadLocalStorageValueForKey(CurrentThreadSchedulerKeyInstance)
<T>(key: protocol<AnyObject, NSCopying>) -> T? { 0038 let currentThread = NSThread.currentThread() 0039 let threadDictionary = currentThread.threadDictionary 0040 0041 return threadDictionary[key] as? T 0042 } 0043 } 0044 0045 #endif 0046