diff --git a/src/net/sf/jaer/hardwareinterface/usb/cypressfx3libusb/CypressFX3.java b/src/net/sf/jaer/hardwareinterface/usb/cypressfx3libusb/CypressFX3.java index 87899b329..a172b57ce 100644 --- a/src/net/sf/jaer/hardwareinterface/usb/cypressfx3libusb/CypressFX3.java +++ b/src/net/sf/jaer/hardwareinterface/usb/cypressfx3libusb/CypressFX3.java @@ -9,12 +9,12 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeSupport; import java.net.URI; -import java.net.URISyntaxException; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.IntBuffer; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; +import java.time.Duration; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; @@ -43,7 +43,6 @@ import net.sf.jaer.event.EventPacket; import net.sf.jaer.eventprocessing.EventFilter; import net.sf.jaer.eventprocessing.FilterChain; -import net.sf.jaer.graphics.AEViewer; import net.sf.jaer.hardwareinterface.BlankDeviceException; import net.sf.jaer.hardwareinterface.HardwareInterfaceException; import net.sf.jaer.hardwareinterface.usb.HasUsbStatistics; @@ -664,6 +663,7 @@ public void stopAEReader() { final AEReader reader = getAeReader(); if (reader != null) { + log.info("Stopping thread "+reader); reader.stopThread(); setAeReader(null); @@ -1039,10 +1039,13 @@ public void stopThread() { log.warning("USB transfer thread became null before stopThread was called; doing nothing"); return; } + log.info("Interrupting USBTransferThread "+usbTransfer); usbTransfer.interrupt(); try { - usbTransfer.join(); + log.info("Waiting for USBTransferThread to join()"); + usbTransfer.join(Duration.ofSeconds(1)); + log.info("USBTransferThread join()'ed"); } catch (final InterruptedException e) { CypressFX3.log.severe("Failed to join AEReaderThread"); @@ -1331,6 +1334,7 @@ public synchronized void setEventAcquisitionEnabled(final boolean enable) throws startAEReader(); } else { + log.info("stopping AEReader"); stopAEReader(); }