Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Main Thread UI and Detached Thread



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Main Thread UI and Detached Thread (From: Mike <email@hidden>)
 >Re: Main Thread UI and Detached Thread (From: j o a r <email@hidden>)
 >Re: Main Thread UI and Detached Thread (From: Mike <email@hidden>)
 >Re: Main Thread UI and Detached Thread (From: j o a r <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.