> I'm migrating one of my project to Swift 3 (xcode 8 beat release).
> Most of the changes were pretty strait-forward, but I have one required 
> change that is still blocking me :
> In my code, I retrieve the current dispatch  queue name using that code :
> 
> let queueName = dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL)
> 
> DispatchQueue objects do have a label attribute, but I cannot find how to get 
> the current dispatch queue.
> What would be the equivalent of it in swift 3 ?
> 
> Any idea would be very welcome :-).

Here's a horrible workaround:

        extension DispatchQueue {
                class var currentLabel: String {
                        return String(validatingUTF8: 
__dispatch_queue_get_label(nil)) 
                }
        }

But I think this is a hole in the current design. I'm not sure if it's an 
*intentional* hole or not; the concept of a "current queue" in general is a bit 
squirrelly.

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to