Is there any way to check whether or not the current thread is the main thread in Objective-C?
I want to do something like this.
- (void)someMethod
UPDATE: seems that is not correct solution, according to queue.h header as mentioned @demosten
The first thought was brought to me, when I was needed this functionality was the line:
dispatch_get_main_queue() == dispatch_get_current_queue();
And had looked to the accepted solution:
[NSThread isMainThread];
mine solution 2.5 times faster.
PS And yes, I'd checked, it works for all threads