Fixed possible problem with the LinuxDevInputController

This commit is contained in:
Maschell 2017-02-06 09:17:22 +01:00
parent 82a25e0cf4
commit 3918a71627
2 changed files with 10 additions and 1 deletions

View File

@ -62,7 +62,7 @@ public abstract class Controller implements Runnable{
if(newData != null){ if(newData != null){
setLatestData(newData); setLatestData(newData);
} }
Utilities.sleep(10); doSleepAfterPollingData();
} }
synchronized (shutdownLock) { synchronized (shutdownLock) {
shutdownState = shutdown; shutdownState = shutdown;
@ -73,6 +73,10 @@ public abstract class Controller implements Runnable{
} }
} }
protected void doSleepAfterPollingData() {
Utilities.sleep(10);
}
@Synchronized("dataLock") @Synchronized("dataLock")
private void setLatestData(byte[] newData) { private void setLatestData(byte[] newData) {
this.latestData = newData; this.latestData = newData;

View File

@ -126,6 +126,11 @@ public class LinuxDevInputController extends Controller implements Runnable{
return newData; return newData;
} }
@Override
protected void doSleepAfterPollingData() {
//This is event driven (aka pollLatestData() is blocking anyway until we have data), we don't need to sleep it all.
}
@Override @Override
public void destroyDriver() { public void destroyDriver() {
try { try {