0001    #if os(Linux)
0002        import Glibc
0003    #else
0004        import Darwin
0005    #endif
0006    
0007    final class SerialQueue
SerialQueue.swift:34
extension SerialQueue: DispatchQueue {
{ 0008 0009 let identifier
SerialQueue.swift:21
        self.identifier = identifier
: String 0010 0011 var events
SerialQueue.swift:22
        self.events = []
SerialQueue.swift:51
                while self.events.count > 0 {
SerialQueue.swift:53
                    let event = self.events.removeFirst()
: [() -> ()] 0012 0013 var eventMutex
SerialQueue.swift:23
        self.eventMutex = pthread_mutex_t()
SerialQueue.swift:41
            pthread_mutex_init(&self.eventMutex, nil)
SerialQueue.swift:52
                    pthread_mutex_lock(&self.eventMutex)
SerialQueue.swift:54
                    pthread_mutex_unlock(&self.eventMutex)
: pthread_mutex_t 0014 0015 var eventCondition
SerialQueue.swift:24
        self.eventCondition = pthread_cond_t()
SerialQueue.swift:45
            pthread_cond_init (&self.eventCondition, nil)
SerialQueue.swift:58
                pthread_cond_wait(&self.eventCondition, &conditionMutex)
: pthread_cond_t 0016 0017 var thread
SerialQueue.swift:28
        self.thread = pthread_t(nil)
SerialQueue.swift:62
        self.runBlock(block, onThread: &thread)
: pthread_t 0018 0019 init(identifier: String) { 0020 0021 self.identifier = identifier 0022 self.events = [] 0023 self.eventMutex = pthread_mutex_t() 0024 self.eventCondition = pthread_cond_t() 0025 #if os(Linux) 0026 self.thread = pthread_t() 0027 #else 0028 self.thread = pthread_t(nil) 0029 #endif 0030 run() 0031 } 0032 } 0033 0034 extension SerialQueue: DispatchQueue { 0035 0036 func run
SerialQueue.swift:30
        run()
() { 0037 0038 let block = { 0039 var conditionMutex = pthread_mutex_t() 0040 0041 pthread_mutex_init(&self.eventMutex, nil) 0042 0043 pthread_mutex_init(&conditionMutex, nil) 0044 0045 pthread_cond_init (&self.eventCondition, nil) 0046 0047 pthread_mutex_lock(&conditionMutex) 0048 0049 while true { 0050 0051 while self.events.count > 0 { 0052 pthread_mutex_lock(&self.eventMutex) 0053 let event = self.events.removeFirst() 0054 pthread_mutex_unlock(&self.eventMutex) 0055 event() 0056 } 0057 0058 pthread_cond_wait(&self.eventCondition, &conditionMutex) 0059 } 0060 } 0061 0062 self.runBlock(block, onThread: &thread) 0063 } 0064 } 0065