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 11:02:12 -0700
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.
j o a r wrote:
On Mar 30, 2008, at 11:55 AM, Mike wrote:
In my worker thread I do a tight processing loop and one of the things
I do in the loop is call two methods in the main thread to update the
display (a text message and progress bar) - via
performSelectorOnMainThread:withObject:waitUntilDone:modes.
However, when the loop runs in the spawned thread, the display doesn't
get updated. If I insert a sleep(1) call into the loop, then the
display updates.
How much work do you perform on the main thread? If a lot, it's not
unexpected that you would se interruptions in display updates. You might
need to throttle or otherwise limit your callouts to the main thread if
this proves to be the problem.
You can use Instruments or Shark to get a view of the work being
performed on the main thread while you run 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