Skip to content

Commit a12b978

Browse files
author
Rob Austin
committed
fixed test case
1 parent e9306e7 commit a12b978

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

affinity/src/main/java/net/openhft/affinity/AffinityLock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ public void bind(boolean wholeCore) {
239239

240240
final boolean canReserve() {
241241

242-
/* if (!LockCheck.isCpuFree(cpuId))
242+
if (!LockCheck.isCpuFree(cpuId))
243243
return false;
244-
*/
244+
245245
if (!reservable) return false;
246246
if (assignedThread != null) {
247247
if (assignedThread.isAlive()) {

affinity/src/test/java/net/openhft/affinity/AffinityLockTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public void assignReleaseThread() throws IOException {
139139
assertEquals(AffinityLock.BASE_AFFINITY, Affinity.getAffinity());
140140
}
141141

142+
142143
@Test
143144
public void testIssue21() throws IOException {
144145
if (!new File("/proc/cpuinfo").exists()) {
@@ -157,7 +158,8 @@ public void testIssue21() throws IOException {
157158

158159
} else {
159160
assertNotSame(alForAnotherThread, al);
160-
assertNotSame(alForAnotherThread.cpuId(), al.cpuId());
161+
if (alForAnotherThread.cpuId() != -1)
162+
assertNotSame(alForAnotherThread.cpuId(), al.cpuId());
161163
}
162164
alForAnotherThread.release();
163165
al.release();

0 commit comments

Comments
 (0)