-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace WindowsJNAAffinity.SetThreadAffinityMask with SetProcessAffin…
…ityMask.
- Loading branch information
Showing
2 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
affinity/src/test/java/net/openhft/affinity/impl/WindowsJNAAffinityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package net.openhft.affinity.impl; | ||
|
||
import net.openhft.affinity.IAffinity; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import java.lang.reflect.Method; | ||
import java.util.BitSet; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assume.assumeTrue; | ||
|
||
public class WindowsJNAAffinityTest extends AbstractAffinityImplTest { | ||
@BeforeClass | ||
public static void checkJniLibraryPresent() { | ||
assumeTrue(System.getProperty("os.name").contains("Win")); | ||
assumeTrue(WindowsJNAAffinity.LOADED); | ||
} | ||
|
||
@Override | ||
public IAffinity getImpl() { | ||
return WindowsJNAAffinity.INSTANCE; | ||
} | ||
|
||
|
||
@Test | ||
public void testSetAffinity() throws Exception { | ||
BitSet affinity = new BitSet(CORES); | ||
affinity.set(0); | ||
getImpl().setAffinity(affinity); | ||
|
||
Method getAffinity0 = WindowsJNAAffinity.class.getDeclaredMethod("getAffinity0"); | ||
getAffinity0.setAccessible(true); | ||
|
||
assertEquals(affinity, getAffinity0.invoke(getImpl())); | ||
} | ||
} |