Cocoanetics / DTFoundation

Standard toolset classes and categories
BSD 2-Clause "Simplified" License
802 stars 237 forks source link

Comparing dispatch_get_current_queue and dispatch_get_main_queue is explicitly forbidden by the documentation #20

Closed JaviSoto closed 11 years ago

JaviSoto commented 11 years ago

Checking the right way if a method is invoked from the main thread. The GCD documentation states: (dispatch/queue.h)

When dispatch_get_current_queue() is called on the main thread, it may or may not return the same value as dispatch_get_main_queue(). Comparing the two is not a valid way to test whether code is executing on the main thread.

odrobnik commented 11 years ago

I guess your approach is safer. Thank you for enhancing it!