0001 // 0002 // DispatchSourceConstants.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 enum DKDispatchSourceType: UInt { 0011 0012 case Unspecified
DispatchSourceConstants.swift:103 public typealias DispatchSourceType = DKDispatchSourceType= 0, 0013 DataAdd
DispatchSourceConstants.swift:109 case .Unspecified:, 0014 DataOr
DispatchSourceConstants.swift:111 case .DataAdd:, 0015 MachRecv
DispatchSourceConstants.swift:113 case .DataOr:, 0016 MachSend
DispatchSourceConstants.swift:115 case .MachRecv:, 0017 Proc
DispatchSourceConstants.swift:117 case .MachSend:, 0018 Read
DispatchSourceConstants.swift:119 case .Proc:, 0019 Signal
DispatchSourceConstants.swift:121 case .Read:, 0020 Timer
DispatchSourceConstants.swift:123 case .Signal:, 0021 VNode
DispatchSourceConstants.swift:125 case .Timer:, 0022 Write
DispatchSourceConstants.swift:127 case .VNode:, 0023 MemoryPressure
DispatchSourceConstants.swift:129 case .Write:0024 0025 } 0026 0027 public struct DKDispatchSourceMachSendFlags
DispatchSourceConstants.swift:131 case .MemoryPressure:: OptionSetType { 0028 0029 public typealias RawValue
DispatchSourceConstants.swift:35 public static let Unspecified = DKDispatchSourceMachSendFlags(rawValue: 0)DispatchSourceConstants.swift:36 public static let Dead = DKDispatchSourceMachSendFlags(rawValue: DISPATCH_MACH_SEND_DEAD)DispatchSourceConstants.swift:138 public typealias DispatchSourceMachSendFlags = DKDispatchSourceMachSendFlags= dispatch_source_mach_send_flags_t 0030 public let rawValue
DispatchSourceConstants.swift:30 public let rawValue: RawValueDispatchSourceConstants.swift:31 public init(rawValue: RawValue) {: RawValue 0031 public init
DispatchSourceConstants.swift:32 self.rawValue = rawValue(rawValue: RawValue) { 0032 self.rawValue = rawValue 0033 } 0034 0035 public static let Unspecified = DKDispatchSourceMachSendFlags(rawValue: 0) 0036 public static let Dead = DKDispatchSourceMachSendFlags(rawValue: DISPATCH_MACH_SEND_DEAD) 0037 0038 } 0039 0040 public struct DKDispatchSourceMemoryPressureFlags
DispatchSourceConstants.swift:35 public static let Unspecified = DKDispatchSourceMachSendFlags(rawValue: 0)DispatchSourceConstants.swift:36 public static let Dead = DKDispatchSourceMachSendFlags(rawValue: DISPATCH_MACH_SEND_DEAD): OptionSetType { 0041 0042 public typealias RawValue
DispatchSourceConstants.swift:48 public static let Unspecified = DKDispatchSourceMemoryPressureFlags(rawValue: 0)DispatchSourceConstants.swift:49 public static let Normal = DKDispatchSourceMemoryPressureFlags(rawValue: DISPATCH_MEMORYPRESSURE_NORMAL)DispatchSourceConstants.swift:50 public static let Warn = DKDispatchSourceMemoryPressureFlags(rawValue: DISPATCH_MEMORYPRESSURE_WARN)DispatchSourceConstants.swift:51 public static let Critical = DKDispatchSourceMemoryPressureFlags(rawValue: DISPATCH_MEMORYPRESSURE_CRITICAL)DispatchSourceConstants.swift:139 public typealias DispatchSourceMemoryPressureFlags = DKDispatchSourceMemoryPressureFlags= dispatch_source_memorypressure_flags_t 0043 public let rawValue
DispatchSourceConstants.swift:43 public let rawValue: RawValueDispatchSourceConstants.swift:44 public init(rawValue: RawValue) {: RawValue 0044 public init
DispatchSourceConstants.swift:45 self.rawValue = rawValue(rawValue: RawValue) { 0045 self.rawValue = rawValue 0046 } 0047 0048 public static let Unspecified = DKDispatchSourceMemoryPressureFlags(rawValue: 0) 0049 public static let Normal = DKDispatchSourceMemoryPressureFlags(rawValue: DISPATCH_MEMORYPRESSURE_NORMAL) 0050 public static let Warn = DKDispatchSourceMemoryPressureFlags(rawValue: DISPATCH_MEMORYPRESSURE_WARN) 0051 public static let Critical = DKDispatchSourceMemoryPressureFlags(rawValue: DISPATCH_MEMORYPRESSURE_CRITICAL) 0052 0053 } 0054 0055 public struct DKDispatchSourceProcFlags
DispatchSourceConstants.swift:48 public static let Unspecified = DKDispatchSourceMemoryPressureFlags(rawValue: 0)DispatchSourceConstants.swift:49 public static let Normal = DKDispatchSourceMemoryPressureFlags(rawValue: DISPATCH_MEMORYPRESSURE_NORMAL)DispatchSourceConstants.swift:50 public static let Warn = DKDispatchSourceMemoryPressureFlags(rawValue: DISPATCH_MEMORYPRESSURE_WARN)DispatchSourceConstants.swift:51 public static let Critical = DKDispatchSourceMemoryPressureFlags(rawValue: DISPATCH_MEMORYPRESSURE_CRITICAL): OptionSetType { 0056 0057 public typealias RawValue
DispatchSourceConstants.swift:63 public static let Unspecified = DKDispatchSourceProcFlags(rawValue: 0)DispatchSourceConstants.swift:64 public static let Exit = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_EXIT)DispatchSourceConstants.swift:65 public static let Fork = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_FORK)DispatchSourceConstants.swift:66 public static let Exec = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_EXEC)DispatchSourceConstants.swift:67 public static let Signal = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_SIGNAL)DispatchSourceConstants.swift:140 public typealias DispatchSourceProcFlags = DKDispatchSourceProcFlags= dispatch_source_proc_flags_t 0058 public let rawValue
DispatchSourceConstants.swift:58 public let rawValue: RawValueDispatchSourceConstants.swift:59 public init(rawValue: RawValue) {: RawValue 0059 public init
DispatchSourceConstants.swift:60 self.rawValue = rawValue(rawValue: RawValue) { 0060 self.rawValue = rawValue 0061 } 0062 0063 public static let Unspecified = DKDispatchSourceProcFlags(rawValue: 0) 0064 public static let Exit = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_EXIT) 0065 public static let Fork = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_FORK) 0066 public static let Exec = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_EXEC) 0067 public static let Signal = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_SIGNAL) 0068 0069 } 0070 0071 public struct DKDispatchSourceVnodeFlags
DispatchSourceConstants.swift:63 public static let Unspecified = DKDispatchSourceProcFlags(rawValue: 0)DispatchSourceConstants.swift:64 public static let Exit = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_EXIT)DispatchSourceConstants.swift:65 public static let Fork = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_FORK)DispatchSourceConstants.swift:66 public static let Exec = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_EXEC)DispatchSourceConstants.swift:67 public static let Signal = DKDispatchSourceProcFlags(rawValue: DISPATCH_PROC_SIGNAL): OptionSetType { 0072 0073 public typealias RawValue
DispatchSourceConstants.swift:79 public static let Unspecified = DKDispatchSourceVnodeFlags(rawValue: 0)DispatchSourceConstants.swift:80 public static let Delete = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_DELETE)DispatchSourceConstants.swift:81 public static let Write = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_WRITE)DispatchSourceConstants.swift:82 public static let Extend = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_EXTEND)DispatchSourceConstants.swift:83 public static let Attrib = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_ATTRIB)DispatchSourceConstants.swift:84 public static let Link = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_LINK)DispatchSourceConstants.swift:85 public static let Rename = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_RENAME)DispatchSourceConstants.swift:86 public static let Revoke = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_REVOKE)DispatchSourceConstants.swift:141 public typealias DispatchSourceVnodeFlags = DKDispatchSourceVnodeFlags= dispatch_source_vnode_flags_t 0074 public let rawValue
DispatchSourceConstants.swift:74 public let rawValue: RawValueDispatchSourceConstants.swift:75 public init(rawValue: RawValue) {: RawValue 0075 public init
DispatchSourceConstants.swift:76 self.rawValue = rawValue(rawValue: RawValue) { 0076 self.rawValue = rawValue 0077 } 0078 0079 public static let Unspecified = DKDispatchSourceVnodeFlags(rawValue: 0) 0080 public static let Delete = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_DELETE) 0081 public static let Write = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_WRITE) 0082 public static let Extend = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_EXTEND) 0083 public static let Attrib = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_ATTRIB) 0084 public static let Link = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_LINK) 0085 public static let Rename = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_RENAME) 0086 public static let Revoke = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_REVOKE) 0087 0088 } 0089 0090 public struct DKDispatchSourceTimerFlags
DispatchSourceConstants.swift:79 public static let Unspecified = DKDispatchSourceVnodeFlags(rawValue: 0)DispatchSourceConstants.swift:80 public static let Delete = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_DELETE)DispatchSourceConstants.swift:81 public static let Write = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_WRITE)DispatchSourceConstants.swift:82 public static let Extend = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_EXTEND)DispatchSourceConstants.swift:83 public static let Attrib = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_ATTRIB)DispatchSourceConstants.swift:84 public static let Link = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_LINK)DispatchSourceConstants.swift:85 public static let Rename = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_RENAME)DispatchSourceConstants.swift:86 public static let Revoke = DKDispatchSourceVnodeFlags(rawValue: DISPATCH_VNODE_REVOKE): OptionSetType { 0091 0092 public typealias RawValue
DispatchSourceConstants.swift:98 public static let Unspecified = DKDispatchSourceTimerFlags(rawValue: 0)DispatchSourceConstants.swift:99 public static let Strict = DKDispatchSourceTimerFlags(rawValue: DISPATCH_TIMER_STRICT)DispatchSourceConstants.swift:142 public typealias DispatchSourceTimerFlags = DKDispatchSourceTimerFlags= dispatch_source_timer_flags_t 0093 public let rawValue
DispatchSourceConstants.swift:93 public let rawValue: RawValueDispatchSourceConstants.swift:94 public init(rawValue: RawValue) {: RawValue 0094 public init
DispatchSourceConstants.swift:95 self.rawValue = rawValue(rawValue: RawValue) { 0095 self.rawValue = rawValue 0096 } 0097 0098 public static let Unspecified = DKDispatchSourceTimerFlags(rawValue: 0) 0099 public static let Strict = DKDispatchSourceTimerFlags(rawValue: DISPATCH_TIMER_STRICT) 0100 0101 } 0102 0103 public typealias DispatchSourceType
DispatchSourceConstants.swift:98 public static let Unspecified = DKDispatchSourceTimerFlags(rawValue: 0)DispatchSourceConstants.swift:99 public static let Strict = DKDispatchSourceTimerFlags(rawValue: DISPATCH_TIMER_STRICT)= DKDispatchSourceType 0104 0105 extension DispatchSourceType { 0106 0107 public func toOpaque
DispatchSource.swift:28 public init!(_ type: DispatchSourceType, handle: UInt = 0, mask: UInt = 0, queue: DispatchQueue) {DispatchSourceConstants.swift:105 extension DispatchSourceType {() -> dispatch_source_type_t { 0108 switch (self) { 0109 case .Unspecified: 0110 return nil 0111 case .DataAdd: 0112 return DISPATCH_SOURCE_TYPE_DATA_ADD 0113 case .DataOr: 0114 return DISPATCH_SOURCE_TYPE_DATA_OR 0115 case .MachRecv: 0116 return DISPATCH_SOURCE_TYPE_MACH_RECV 0117 case .MachSend: 0118 return DISPATCH_SOURCE_TYPE_MACH_SEND 0119 case .Proc: 0120 return DISPATCH_SOURCE_TYPE_PROC 0121 case .Read: 0122 return DISPATCH_SOURCE_TYPE_READ 0123 case .Signal: 0124 return DISPATCH_SOURCE_TYPE_SIGNAL 0125 case .Timer: 0126 return DISPATCH_SOURCE_TYPE_TIMER 0127 case .VNode: 0128 return DISPATCH_SOURCE_TYPE_VNODE 0129 case .Write: 0130 return DISPATCH_SOURCE_TYPE_WRITE 0131 case .MemoryPressure: 0132 return DISPATCH_SOURCE_TYPE_MEMORYPRESSURE 0133 } 0134 } 0135 0136 } 0137 0138 public typealias DispatchSourceMachSendFlags = DKDispatchSourceMachSendFlags 0139 public typealias DispatchSourceMemoryPressureFlags = DKDispatchSourceMemoryPressureFlags 0140 public typealias DispatchSourceProcFlags = DKDispatchSourceProcFlags 0141 public typealias DispatchSourceVnodeFlags = DKDispatchSourceVnodeFlags 0142 public typealias DispatchSourceTimerFlags = DKDispatchSourceTimerFlags 0143
DispatchSource.swift:29 guard let rawValue = dispatch_source_create(type.toOpaque(), handle, mask, queue.rawValue) else {