• 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: Re: Yielding an NSThread-started thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Yielding an NSThread-started thread


  • Subject: Re: Re: Yielding an NSThread-started thread
  • From: "Philip Q" <email@hidden>
  • Date: Wed, 22 Nov 2006 13:27:56 +1300

On 22/11/06, Alastair Houghton <email@hidden> wrote:
If you read the documentation, you'll see that NSThread is layered on
top of POSIX threads, so you can safely call pthread_yield().

Oops, I seem to have missed that sentence.

Generally speaking, however, you wouldn't want to do that; it's much
better to signal a thread explicitly using a condition variable, a
mutex or some other kind of synchronisable object.  Is there some
reason that you can't do that in your case?

In this case, I'm signalling a thread to exit, but while it wraps the other thread has nothing to do but wait for it, so instead of continually polling the condition variable it might as well yield after each check to give the other thread the chance to do something.

-Phil
_______________________________________________

Cocoa-dev mailing list      (email@hidden)

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


  • Follow-Ups:
    • Re: Yielding an NSThread-started thread
      • From: Alastair Houghton <email@hidden>
References: 
 >Yielding an NSThread-started thread (From: "Philip Q" <email@hidden>)
 >Re: Yielding an NSThread-started thread (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: External kill of an NSThread?
  • Next by Date: Re: Yielding an NSThread-started thread
  • Previous by thread: Re: Yielding an NSThread-started thread
  • Next by thread: Re: Yielding an NSThread-started thread
  • Index(es):
    • Date
    • Thread