FROM : Shawn Erickson
DATE : Tue May 20 22:56:00 2008
On Mon, May 19, 2008 at 11:53 PM, Vitaly Ovchinnikov
<vitaly.<email_removed>> wrote:
> 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.
If you send your progress view a setUsesThreadedAnimation: message
with a value of YES do it continue to animate?
If it does then you are somehow blocking your main thread.
-Shawn
DATE : Tue May 20 22:56:00 2008
On Mon, May 19, 2008 at 11:53 PM, Vitaly Ovchinnikov
<vitaly.<email_removed>> wrote:
> 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.
If you send your progress view a setUsesThreadedAnimation: message
with a value of YES do it continue to animate?
If it does then you are somehow blocking your main thread.
-Shawn






Cocoa mail archive

