• 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: Philip Lukidis <email@hidden>
  • Date: Thu, 10 Nov 2005 15:09:38 -0500

OK, I'll file a bug report asking for a clarification.  Yes, you're right, it never said that a pthread would not have a runloop, just that the runloop would not associated with the created pthread.
 
thanks,
 
Philip Lukidis
-----Original Message-----
From: Garth Cummings [mailto:email@hidden]
Sent: Thursday, November 10, 2005 2:35 PM
To: Philip Lukidis
Cc: email@hidden
Subject: Re: pthreads and CF runloops (possibly slightly OT)

Hi Philip,

On Nov 10, 2005, at 10:21 AM, Philip Lukidis wrote:

Hi Garth, thanks for your answer.  Sorry about that bad link, it should point to:
-Multithreading Topics -> Thread packages -> POSIX Threads, and the quote is:
"For example, unlike other threading packages, a POSIX thread does not automatically associate itself with your application’s run loop."

I agree with Shawn--I really don't understand the point of this sentence. Could you please file a bug report asking that this language be made clearer?

I can guess that they're trying to point out that the Cocoa threading model, for example, can explicitly run any code on the main thread even if initiated from another thread. If you are using naked pthreads and want to do UI, you'd have to work out your own rendezvous mechanism with your main thread to have it run the UI.

Note that it doesn't say that a pthread doesn't _have_ a run loop though.

 
However, I'm glad to find out that this is false.  I'll definitely call CFRunLoopRun().
 
thanks,
 
Philip Lukidis

--gc

-----Original Message-----
From: Garth Cummings [mailto:email@hidden]
Sent: Thursday, November 10, 2005 12:26 PM
To: Philip Lukidis
Cc: email@hidden
Subject: Re: pthreads and CF runloops (possibly slightly OT)

Hi Philip,

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

However, I've read that a "POSIX thread does not
automatically associate itself with your application's run loop" (see link
below, sorry for the wrapping).

http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/ind
ex.html?http://developer.apple.com/documentation/Cocoa/Conceptual/Multithrea
ding/Multithreading.html

That link points to the top of that document. Were you thinking of <http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/articles/ThreadIntro.html>? That says:

Threads and run loops are tightly entwined entities. Many simple threads do not use the run loop and simply execute the code in their entry-point function. However, if you want your thread to remain running so that it can process requests at a future time, you need to start the thread’s run loop.


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

Yes, to both questions. The confusion might be that the run loop isn't automatically _started_ when the thread runs. That can be done with CFRunLoopRun after attaching at least one run loop event source.

HTH,
--gc


__________________________________________________________________
Garth Cummings                
Apple Developer Technical Support     email@hidden

http://developer.apple.com/technicalsupport


 _______________________________________________
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

__________________________________________________________________

Garth Cummings                                   1 Infinite Loop, MS 303-2T

Apple Developer Technical Support       Cupertino, CA 95014

                               

"The last good thing written in C was    408-974-7711 phone

Franz Schubert's Symphony No. 9."       408-862-7602 fax

--Erwin Dieterich                                  email@hidden



 _______________________________________________
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

  • 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: darwinbuild
  • Index(es):
    • Date
    • Thread