Class ThreadAffinity


  • public class ThreadAffinity
    extends Object
    OS-depended thread wrapper implemented based on JNA.

    Please note that the library should be available in the classpath during runtime.

    Currently it support Windows and Linux.

    • Constructor Detail

      • ThreadAffinity

        public ThreadAffinity()
    • Method Detail

      • setAffinity

        public static long setAffinity​(int[] cpuIndexes)
        Sets the thread affinity for the current thread.
        Parameters:
        cpuIndexes - logical processors list that a thread is allowed to run on (first logical CPU has index 0).
        Returns:
        On success, the affinity mask will be returned, otherwise 0.