• 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: pthreads and CF runloops (possibly slightly OT)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pthreads and CF runloops (possibly slightly OT)


  • Subject: Re: pthreads and CF runloops (possibly slightly OT)
  • From: Shawn Erickson <email@hidden>
  • Date: Thu, 10 Nov 2005 09:34:32 -0800


On Nov 10, 2005, at 9:07 AM, Philip Lukidis wrote:

Is this true?

To be honest I am not sure I understand that statement in the developer documentation... It may make sense to file a doc defect to get that statement better clarified, it is a little lose in terminology (I assume "your application's run loop" means your applications main thread's runloop).


When I create a pthread, is a new run loop created, and is
the pthread associated with it?

Likely no because I believe they are created lazily but that is an implementation detail (one that I am guessing at myself).


I ask this because I've done a simple (naive) test of outputting the address of my main runloop, and then
outputting the address of a pthread runloop, and they are different.

They should be different since they are different threads. Each thread can get its own runloop which is basically a thread local data structure.


I've also modified my simple daemon to receive client messages in the created
pthread, which seems to work.

Can you better explain how you did this so we can help make sure we (and you) understand things? I ask given the following question.


So the question is, are pthreads associated with a runloop, and, if not, how
can I create a runloop and associate a pthread with it?

In this case when running under your pthread simply use CFRunLoopGetCurrent() but if in Cocoa/Carbon use their API for runloops. Of course that only gets you a valid reference for the runloop associated with the current thread (possibly "creating" it if needed). To actually have the runloop do what it does you need to run it.


<http://developer.apple.com/documentation/CoreFoundation/Conceptual/ CFRunLoops/Tasks/Running.html>

-Shawn

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >pthreads and CF runloops (possibly slightly OT) (From: Philip Lukidis <email@hidden>)

  • Prev by Date: Re: pthreads and CF runloops (possibly slightly OT)
  • Next by Date: RE: pthreads and CF runloops (possibly slightly OT)
  • Previous by thread: Re: pthreads and CF runloops (possibly slightly OT)
  • Next by thread: RE: pthreads and CF runloops (possibly slightly OT)
  • Index(es):
    • Date
    • Thread