Re: Main Thread UI and Detached Thread
Re: Main Thread UI and Detached Thread
- Subject: Re: Main Thread UI and Detached Thread
- From: Mike <email@hidden>
- Date: Mon, 31 Mar 2008 12:20:41 -0700
I have two methods in the main thread that I call from the worker using
performSelector, etc. The method for updating the progress bar for
example looks like this:
- (void)setProgressBarValue:(double)value
{
if( progressBar )
{
[ progressBar setDoubleValue:value ];
[ progressBar setNeedsDisplay:YES ];
[ progressBar display ];
}
}
The one for the message is similar. All the code works perfectly when I
sleep or if the worker terminates so I know there is noting wrong inside
the selectors I am calling.
This is a pretty simple app and I don't have time to dive into
performance tools to discover why a single thread in a 10-page app isn't
doing what it's advertised to do.
-m
============
j o a r wrote:
On Mar 31, 2008, at 11:02 AM, Mike wrote:
I'm not doing any work on the main thread while the spawned thread
runs. In fact, the main thread is just idling doing nothing. And the
behavior isn't really a responsiveness issue: the rest of the UI still
responds fine, but my indicators that I update in the UI do *nothing*
the entire time the spawned thread is running. Nothing. No activity.
If I take the sleep calls out, then main thread updates the UI
instantly upon termination of the spawned thread.
You said that you're calling the main thread, so I expect it to do
*something*...
How do you notify the controls in the UI that they need to update to
reflect new values?
What is the total time required to run the task by your worker thread?
j o a r
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden