Re: which processor is a thread executing on?
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Wade _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... I am writing a multi-threaded app, and I would like to know which processor the thread is executing on. Is there a pthread function call to determine this? There is not. As Andreas noted, you can't do this reliably without being forcefully bound to a particular CPU, in which case you already know, and which is strongly discouraged in any case. You can do it, though. You can execute CPUID and figure it out from there. But CPUID is a very expensive little instruction - it takes something like ~100ns to execute on today's machines, and has other side-effects - so you don't want to call it too often. But the most pertinent question, really, is why you want to do this? Either there's a better way to do whatever you're ultimately trying to do, or it's something that you should file an enhancement request for, if it's worth doing. This email sent to site_archiver@lists.apple.com
participants (1)
-
Wade Tregaskis