Skip to content

Commit f750455

Browse files
committed
Try to ensure there is always a CpuLayout
1 parent 6341d56 commit f750455

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/main/java/vanilla/java/affinity/AffinityLock.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class AffinityLock {
4747
private static AffinityLock[] LOCKS;
4848
private static NavigableMap<Integer, AffinityLock[]> CORES; // set by cpuLayout()
4949
private static final AffinityLock NONE = new AffinityLock(-1, false, false);
50-
private static CpuLayout cpuLayout = new NoCpuLayout(PROCESSORS);
50+
private static CpuLayout cpuLayout = null;
5151

5252
static {
5353
try {
@@ -57,6 +57,7 @@ public class AffinityLock {
5757
LOCKS = new AffinityLock[PROCESSORS];
5858
for (int i = 0; i < PROCESSORS; i++)
5959
LOCKS[i] = new AffinityLock(i, ((BASE_AFFINITY >> i) & 1) != 0, ((RESERVED_AFFINITY >> i) & 1) != 0);
60+
cpuLayout(new NoCpuLayout(PROCESSORS));
6061
}
6162
} catch (IOException e) {
6263
LOGGER.log(Level.WARNING, "Unable to load /proc/cpuinfo", e);

0 commit comments

Comments
 (0)