open() now returns with all threads ALWAYS alive

pull/13/head
Felipe Herranz 2015-09-02 12:03:32 +02:00
rodzic 3f1857008f
commit b0f6388832
1 zmienionych plików z 4 dodań i 11 usunięć

Wyświetl plik

@ -44,16 +44,6 @@ public abstract class UsbSerialDevice implements UsbSerialInterface
this.device = device;
this.connection = connection;
serialBuffer = new SerialBuffer(mr1Version);
if(mr1Version)
{
workerThread = new WorkerThread();
workerThread.start();
}else
{
readThread = new ReadThread();
}
writeThread = new WriteThread();
writeThread.start();
}
public static UsbSerialDevice createUsbSerialDevice(UsbDevice device, UsbDeviceConnection connection)
@ -286,7 +276,7 @@ public abstract class UsbSerialDevice implements UsbSerialInterface
{
dataReceived = serialBuffer.getDataReceivedCompatible(numberBytes);
// FTDI devices reserves two first bytes of an IN endpoint with info about
// FTDI devices reserve two first bytes of an IN endpoint with info about
// modem and Line.
if(isFTDIDevice())
{
@ -352,10 +342,12 @@ public abstract class UsbSerialDevice implements UsbSerialInterface
{
workerThread = new WorkerThread();
workerThread.start();
while(!workerThread.isAlive()){} // Busy waiting
}else if(!mr1Version && readThread == null)
{
readThread = new ReadThread();
readThread.start();
while(!readThread.isAlive()){} // Busy waiting
}
}
@ -375,6 +367,7 @@ public abstract class UsbSerialDevice implements UsbSerialInterface
{
writeThread = new WriteThread();
writeThread.start();
while(!writeThread.isAlive()){} // Busy waiting
}
}
}