Skip to content

Commit 1f706bc

Browse files
committed
Comment why i > 0
1 parent eb5adba commit 1f706bc

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ public static AffinityLock acquireCore(boolean bind) {
114114
private static AffinityLock acquireLock(boolean bind, int cpuId, AffinityStrategy... strategies) {
115115
synchronized (AffinityLock.class) {
116116
for (AffinityStrategy strategy : strategies) {
117+
// consider all processors except core 0 which is usually used by the OS.
118+
// if you have only one core, this library is not approriate in any case.
117119
for (int i = PROCESSORS - 1; i > 0; i--) {
118120
AffinityLock al = LOCKS[i];
119121
if (al.canReserve() && strategy.matches(cpuId, i)) {

0 commit comments

Comments
 (0)