• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pausing and terminating a thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pausing and terminating a thread


  • Subject: Re: Pausing and terminating a thread
  • From: Doug Wyatt <email@hidden>
  • Date: Tue, 30 Aug 2005 21:49:55 -0700

On Aug 30, 2005, at 15:18, Ben Haller wrote:
If your work loop is doing easy, fast stuff, you end up checking the flag a *lot*, and it slows down your work significantly. Unrolling your work loop can help somewhat, but of course you don't want to do that too much or you'll start causing cache problems because your code is too big, plus of course unrolled code is hard to maintain. So it's an annoying problem.

You don't have to unroll ... an approach like this works and for all but the most trivial work loops adds negligible overhead.


int iteration = 0;
while (.... doing some work ....) {


if (++iteration == 100) { // update progress bar, check to see if you're done iteration = 0; } }


-- Doug Wyatt http://www.dougwyatt.net/ <-- music http://www.sonosphere.com/Doug/ <-- etc.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Pausing and terminating a thread (From: Hamish Allan <email@hidden>)
 >Re: Pausing and terminating a thread (From: Ben Haller <email@hidden>)

  • Prev by Date: Re: Pausing and terminating a thread
  • Next by Date: Re: NSKeyedArchiver - better ways to autosave documents?
  • Previous by thread: Re: Pausing and terminating a thread
  • Next by thread: Re: Pausing and terminating a thread
  • Index(es):
    • Date
    • Thread