Revision: 54970
http://brlcad.svn.sourceforge.net/brlcad/?rev=54970&view=rev
Author: brlcad
Date: 2013-03-29 16:17:54 +0000 (Fri, 29 Mar 2013)
Log Message:
-----------
document the mac interface since it's substantially different than the pthread
api
Modified Paths:
--------------
brlcad/trunk/src/libbu/affinity.c
Modified: brlcad/trunk/src/libbu/affinity.c
===================================================================
--- brlcad/trunk/src/libbu/affinity.c 2013-03-29 15:51:34 UTC (rev 54969)
+++ brlcad/trunk/src/libbu/affinity.c 2013-03-29 16:17:54 UTC (rev 54970)
@@ -108,18 +108,25 @@
#elif defined(HAVE_MACH_THREAD_POLICY_H)
- /* Mac OS X mach thread affinity hinting */
+ /* Mac OS X mach thread affinity hinting. Mach implements a CPU
+ * affinity policy by default so this just sets up an additional
+ * hint on how threads can be grouped/ungrouped. Here we set all
+ * threads up into their own group so threads will get their own
+ * cpu and hopefully be kept in place by Mach from there.
+ */
thread_extended_policy_data_t epolicy;
thread_affinity_policy_data_t apolicy;
thread_t curr_thread = mach_thread_self();
kern_return_t ret;
+ /* discourage interrupting this thread */
epolicy.timeshare = FALSE;
ret = thread_policy_set(curr_thread, THREAD_EXTENDED_POLICY,
(thread_policy_t) &epolicy, THREAD_EXTENDED_POLICY_COUNT);
if (ret != KERN_SUCCESS)
return -1;
+ /* put each thread into a separate group */
apolicy.affinity_tag = curr_thread;
ret = thread_policy_set(curr_thread, THREAD_EXTENDED_POLICY,
(thread_policy_t) &apolicy, THREAD_EXTENDED_POLICY_COUNT);
if (ret != KERN_SUCCESS)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete
for recognition, cash, and the chance to get your game on Steam.
$5K grand prize plus 10 genre and skill prizes. Submit your demo
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits