Skip to content

Commit

Permalink
Removed race conditions and commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
TomaszTB committed Feb 5, 2025
1 parent af860b9 commit 5707cae
Showing 1 changed file with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public void testStartKill()

// Kill the thread, wait for it to die
thread.kill();
assertState(thread, false, true, 0, false, 0);
assertDoesNotThrow(() -> thread.join(1000));
assertState(thread, false, false, 0, false, 0);

Expand All @@ -53,15 +52,13 @@ public void testStartRepeatKill()

// Start the thread. Should start running the repetitions
thread.start();
assertState(thread, true, true, repetitionsToRun, false, 0);

// Wait for all repetitions to complete
thread.blockUntilNoScheduledTasks();
assertState(thread, true, true, 0, false, repetitionsToRun);

// Kill the thread and wait for it to die
thread.kill();
assertState(thread, false, true, 0, false, repetitionsToRun);
assertDoesNotThrow(() -> thread.join(1000));
assertState(thread, false, false, 0, false, repetitionsToRun);

Expand Down Expand Up @@ -101,7 +98,6 @@ public void testStartPauseStart()

// Kill the thread
thread.kill();
assertState(thread, false, true, 0, true, 1);
assertDoesNotThrow(() -> thread.join(1000));
assertState(thread, false, false, 0, false, 2);
}
Expand Down Expand Up @@ -169,11 +165,6 @@ public void testInvalidStarts()
thread2.startRepeating();
thread2.blockingKill();
assertThrows(IllegalThreadStateException.class, thread2::startRepeating);

// Can start after kill if the thread hasn't been started yet???
// RepeatingTaskThread thread0 = new RepeatingTaskThread(NAME, runnable);
// thread0.kill();
// assertThrows(IllegalThreadStateException.class, thread0::startRepeating);
}

@Test
Expand Down

0 comments on commit 5707cae

Please sign in to comment.