0001 // 0002 // DispatchGroup.swift 0003 // DispatchKit <https://github.com/anpol/DispatchKit> 0004 // 0005 // Copyright (c) 2014 Andrei Polushin. All rights reserved. 0006 // 0007 0008 import Foundation 0009 0010 public struct DispatchGroup: DispatchObject, DispatchEnterable, DispatchWaitable { 0011 0012 @available(*, unavailable, renamed="rawValue") 0013 public var group: dispatch_group_t { 0014 return rawValue 0015 } 0016 0017 @available(*, unavailable, renamed="DispatchGroup(rawValue:)") 0018 public init(raw group: dispatch_group_t) { 0019 self.rawValue = group 0020 } 0021 0022 public let rawValue
DispatchQueue.swift:123 public func async(group: DispatchGroup, block: dispatch_block_t) {: dispatch_group_t 0023 0024 public init(rawValue: dispatch_group_t) { 0025 self.rawValue = rawValue 0026 } 0027 0028 public init!() { 0029 guard let rawValue = dispatch_group_create() else { 0030 return nil 0031 } 0032 0033 self.rawValue = rawValue 0034 } 0035 0036 0037 public func enter() { 0038 dispatch_group_enter(rawValue) 0039 } 0040 0041 public func leave() { 0042 dispatch_group_leave(rawValue) 0043 } 0044 0045 0046 public func wait() -> Int { 0047 // default argument is not permitted in protocol method in #swift 0048 return wait(.Forever) 0049 } 0050 0051 public func wait
DispatchGroup.swift:25 self.rawValue = rawValueDispatchGroup.swift:33 self.rawValue = rawValueDispatchGroup.swift:38 dispatch_group_enter(rawValue)DispatchGroup.swift:42 dispatch_group_leave(rawValue)DispatchGroup.swift:52 return dispatch_group_wait(rawValue, timeout.rawValue)DispatchGroup.swift:56 dispatch_group_notify(rawValue, queue.rawValue, block)DispatchQueue.swift:124 dispatch_group_async(group.rawValue, rawValue, block)(timeout: DispatchTime) -> Int { 0052 return dispatch_group_wait(rawValue, timeout.rawValue) 0053 } 0054 0055 public func notify(queue: DispatchQueue, block: dispatch_block_t) { 0056 dispatch_group_notify(rawValue, queue.rawValue, block) 0057 } 0058 0059 0060 // See also DispatchQueue.async(group,block) 0061 0062 } 0063
DispatchGroup.swift:48 return wait(.Forever)