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
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
Hi
Philip,
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
_______________________________________________
Do not post admin requests to the list. They will
be ignored.
Help/Unsubscribe/Update your Subscription:
__________________________________________________________________
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
|