• 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: Problem killing my threads :)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem killing my threads :)


  • Subject: Re: Problem killing my threads :)
  • From: Nathan Day <email@hidden>
  • Date: Tue, 24 Sep 2002 00:45:05 +0930

You don't need a lock, if you only have the one variable since you can change the variable atomically as long as you variable is word aligned. And even if it isn't atomic what's is going to go wrong, your thread will execute the loop one too many times, if that is a problem then you are doing things the wrong way.

On Monday, September 23, 2002, at 11:41 PM, Sherm Pendley wrote:

You may take a minor performance hit, if the "worker" thread checks for the "threadShouldTerminate" variable with every iteration through a loop - especially if it first obtains a lock on it, which it probably should. I doubt it would be much of an issue, though, unless it's a very small loop with a few bazillion repetitions.

Nathan Day
http://homepage.mac.com/nathan_day/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Problem killing my threads :) (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: Licences 101 - Copy Protection for Newbies
  • Next by Date: Re: needed Time for a method
  • Previous by thread: Re: Problem killing my threads :)
  • Next by thread: Re: Problem killing my threads :)
  • Index(es):
    • Date
    • Thread