If there is, it is not publicly available and may be unstable.
If you press WTF in your code, rename and replay it to make sense. Since you need a dummy object using a dummy selector, you can simply add a throwaway class, such as CocoaMultithreading , and then send the message +beginMultithreading :
@interface CocoaMultithreading : NSObject + (void)beginMultithreading; @end int main(void) { [CocoaMultithreading beginMultithreading]; return EXIT_SUCCESS; } @implementation CocoaMultithreading + (void)dummyThread:(id)unused { (void)unused; } + (void)beginMultithreading { [NSThread detachNewThreadSelector:@selector(dummyThread:) toTarget:self withObject:nil]; } @end
This should be fairly explicit.
ETA: Alexander Staubo points out that with OS X 10.5 / iOS 2.0 you can directly call the -start method on NSThread , so the easiest way to flip Cocoa multithreading would be:
void XXXActivateCocoaMultithreading(void) { [[NSThread new] start]; }
Then in your main function:
XXXActivateCocoaMultithreading();
This is obvious, but much less erratic. ( XXX there to remind you of the prefixes of non-static functions. Since static functions often become unsteady at some point, prefixing them all from the beginning is a good move.)
source share