#include <sched.h>

/* call such that CPU 0 is '1'
 */
int pin_it_(unsigned *mask_in)
{
   unsigned long mask = *mask_in;
   mask = 1 << (mask);
   printf("affinity set to cpu %u, mask set to %lu\n", *mask_in, mask);
   if (sched_setaffinity(0, sizeof(unsigned long), &mask) == -1)
   {
      perror("affinity setting problem");
      return 1;
   }
   return 0;
}

-----------

      Program Hello
      INTEGER RESULT

      write (*,*) "Calling Affinity setter"
      CALL pin_it(255)
      write (*,*) "Affinity called"
      END

-- MattWalsh - 29 Aug 2006

Topic revision: r1 - 29 Aug 2006 - MattWalsh
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback