@Test public void testAffinity() throws Exception { Assert.assertEquals(0, Os.setCurrentThreadAffinity(0)); AtomicInteger result = new AtomicInteger(-1); CountDownLatch threadHalt = new CountDownLatch(1); new Thread(() -> { result.set(Os.setCurrentThreadAffinity(1)); threadHalt.countDown(); }).start(); Assert.assertTrue(threadHalt.await(1, TimeUnit.SECONDS)); Assert.assertEquals(0, result.get()); Assert.assertEquals(0, Os.setCurrentThreadAffinity(-1)); }
public static int setCurrentThreadAffinity(int cpu) { if (cpu == -1) { return 0; } return setCurrentThreadAffinity0(cpu); }
Os { public static int setCurrentThreadAffinity(int cpu) { if (cpu == -1) { return 0; } return setCurrentThreadAffinity0(cpu); } }
Os { public static int setCurrentThreadAffinity(int cpu) { if (cpu == -1) { return 0; } return setCurrentThreadAffinity0(cpu); } private  Os(); }
Os { public static int setCurrentThreadAffinity(int cpu) { if (cpu == -1) { return 0; } return setCurrentThreadAffinity0(cpu); } private  Os(); static native long currentTimeMicros(); static native long currentTimeNanos(); static native int errno(); static long forkExec(CharSequence args); static int forkExecPid(long forkExecT); static int forkExecReadFd(long forkExecT); static int forkExecWriteFd(long forkExecT); static byte[] generateKerberosToken(CharSequence spn); static native int getPid(); @SuppressWarnings("EmptyMethod") static void init(); static int setCurrentThreadAffinity(int cpu); }
Os { public static int setCurrentThreadAffinity(int cpu) { if (cpu == -1) { return 0; } return setCurrentThreadAffinity0(cpu); } private  Os(); static native long currentTimeMicros(); static native long currentTimeNanos(); static native int errno(); static long forkExec(CharSequence args); static int forkExecPid(long forkExecT); static int forkExecReadFd(long forkExecT); static int forkExecWriteFd(long forkExecT); static byte[] generateKerberosToken(CharSequence spn); static native int getPid(); @SuppressWarnings("EmptyMethod") static void init(); static int setCurrentThreadAffinity(int cpu); static final int WINDOWS; static final int _32Bit; static final int type; static final int OSX; static final int LINUX_AMD64; static final int LINUX_ARM64; static final int FREEBSD; }