Hello I work on Cocoa application that uses posix thread to perform big calculations. I need to display the progress. Big caculations are done with C++ and I have a callback function that called by the calculating thread with the current progress (structure with data). I put this structures to the queue (std::vector, guarded by the mutex). This is the separate thread.
Now the main thread: I need to check my queue and (among other things) update the progress. So I created NSTimer (with period of 0.1 second) that checks my queue and (among other things) calls -setDoubleValue for NSProgressIndicator. Maybe it looks a bit tricky, but it is just a marshalling of structures from one thread to another, it worked fine for me in Windows, it is tested etc.... Now the problem: progress indicator freezes. It doesn't even play animation! It may move to 30% and freeze there. I tried -setNeedsDisplay, -displayIfNeeded, even -display - they all don't help. Progress doesn't move, but if I click the window at this moment - progress returns to life and moves as it have to. I tried to call -animate for progress in every timer cycle. In that case progress animates but doesn't move! I added NSLog() calls to make sure the code is called - it does. I pass absolutely correct values. I placed NSTextField near the progress and added -setDoubleValue call with the same value for the text field - it updates, but progress is still frozen. I checked the thread where I update progress - it is the main thread. I tried to move progress update from timer to selector that was called by performSelectorFromMainThread - doesn't help too. While searching the Internet I found similar problems, but all of them were related to main loop's block. Mine is not blocked - all calculations performed in the separate thread. Calling -display that always helps, doesn't help to me. One more thing: I tried to replace simple -setDoubleValue with the pair: [progress setDoubleValue:0]; [progress setDoubleValue:nActualValue]; this helps, progress moves, but animation does not work anyway... The problem... Ideas? _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]