This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension DispatchQueue { | |
private static let dispatch_get_current_queue = dlsym(dlopen(nil, RTLD_GLOBAL), "dispatch_get_current_queue") | |
static var current: DispatchQueue { | |
dispatch_get_current_queue.map { | |
unsafeBitCast($0, to: (@convention(c) () -> Unmanaged<DispatchQueue>).self)().takeUnretainedValue() | |
} ?? .global(qos: .background) | |
} | |
} |