I am working on a small application written in objective-c using the cocoa framework, and I have a multithreading problem. I would really appreciate it if someone could help me with some guidance on how to stop the secondary (worker) thread from the main thread?
- (IBAction)startWorking:(id)sender { [NSThread detachNewThreadSelector:@selector(threadMain:) toTarget:self withObject:nil]; } - (void)threadMain {
I found something on apple docs , but in this example there is no part in which the input runloop source changes the value of exitNow.
In addition, I will not use many threads in my application, so I would prefer a simple solution (at a lower cost) than a more complex one, which could easily manage many threads, but with a lot of overhead (for example, using locks, maybe (?) instead of runloops)
Thanks in advance
multithreading objective-c cocoa
andi
source share