KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a worker thread that I want to do one bit of its task, then pause & wait for the "ok, continue" command from another thread, then pause & wait, etc. The use case is: the controlling object is a view that I want to display information about what's going on inside the worker-thread, and allow me to "single-step" through the worker as it does it's thing. The rather ugly and heavy-handed thing that I have in my worker is this: NSLog(@"paused"); paused = YES; while (paused) { [NSThread sleepForTimeInterval:0.25]; } NSLog(@".. continuing"); ...But I can't help but think that there must be a nicer way, perhaps involving NSLocks, or some such. Comments, hints suggestions? Thanks!
Tags (comma-separated)
Save Edits
Cancel