pthreads and CF runloops (possibly slightly OT)
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Sorry if this is slightly OT, but I could not find a better list. Hi, I have starting to think about the architecture of a server, which will be a daemon (it will enumerate all connected instances my hardware plugged into USB, among other things). Currently, a single threaded quick prototype server receives requests from clients through CFMessagePort. Now my background is Windows drivers (and usermode to some degree), so forgive the naivety of my questions. I've been reading up on thread implementations, and I saw something related to pthreads which alarmed me. I thought that each time a thread was created it had a runloop associated with it. My server program requires this, I believe, because runloops are used with CFMessagePort. 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 Is this true? When I create a pthread, is a new run loop created, and is the pthread associated with it? 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. I've also modified my simple daemon to receive client messages in the created pthread, which seems to work. 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? Sorry if this is OT for this group... thanks, Philip Lukidis _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Philip Lukidis