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

Re: Yielding an NSThread-started thread


  • Subject: Re: Yielding an NSThread-started thread
  • From: Alastair Houghton <email@hidden>
  • Date: Tue, 21 Nov 2006 14:12:26 +0000

On 21 Nov 2006, at 13:11, Philip Q wrote:

Is there a recommended/good way to yield a thread started using
NSThread while it waits for another?

pthread has pthread_yield(), libc has sched_yield(), Thread Manager
has YieldToAnyThread(), Multiprocessing Services has MPYield() -- but
I don't see a Cocoa one, and I don't know what the unexpected
consequences might be of calling one from another library?

If you read the documentation, you'll see that NSThread is layered on top of POSIX threads, so you can safely call pthread_yield().


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?

Kind regards,

Alastair.

--
http://alastairs-place.net


_______________________________________________ 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
  • Follow-Ups:
    • Re: Re: Yielding an NSThread-started thread
      • From: "Philip Q" <email@hidden>
    • Re: Yielding an NSThread-started thread
      • From: John Stiles <email@hidden>
References: 
 >Yielding an NSThread-started thread (From: "Philip Q" <email@hidden>)

  • Prev by Date: Re: New WebView
  • Next by Date: Problem saving an existing document (as a package) to a WebDAV folder
  • Previous by thread: Re: Yielding an NSThread-started thread
  • Next by thread: Re: Yielding an NSThread-started thread
  • Index(es):
    • Date
    • Thread