Skip to content

Commit

Permalink
disabling update interval also disables gpu reader thread
Browse files Browse the repository at this point in the history
  • Loading branch information
olepoeschl committed Aug 15, 2023
1 parent 0d0841c commit 73ef04f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main/java/de/nqueensfaf/impl/GPUSolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ private void runDevice(MemoryStack stack, IntBuffer errBuf, Device device) {
// run
enqueueKernel(errBuf, device);
// start a thread continuously reading device data
deviceReaderThread(device).start();
if(config.updateInterval > 0)
deviceReaderThread(device).start();

// wait for kernel to finish
clFinish(device.xqueue);
Expand All @@ -317,12 +318,14 @@ private void runDevice(MemoryStack stack, IntBuffer errBuf, Device device) {
}
}

device.stopReaderThread = 1; // stop the devices reader thread
while (device.stopReaderThread != 0) { // wait until the thread has terminated
try {
Thread.sleep(50);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
if (config.updateInterval > 0) {
device.stopReaderThread = 1; // stop the devices reader thread
while (device.stopReaderThread != 0) { // wait until the thread has terminated
try {
Thread.sleep(50);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}

Expand Down

0 comments on commit 73ef04f

Please sign in to comment.