I am new to threading and have a JAVA code running on my Raspberry PI to control an arduino uno. in my JAVA code I have to threads that are initialised when the connection to the serial port is made. One of these threads is for writing data to the serial port, the other is for reading from it.
As I see it they do not share any data, so is it therefor necessary to implement any thread safety?
code snippet from the connection class:
InputStream in = serialPort.getInputStream();
OutputStream out = serialPort.getOutputStream();
SerialReader sr = new SerialReader(in);
Thread reader = new Thread(sr);
reader.start();
SerialWriter wr = new SerialWriter(out);
Thread writer = new Thread(wr);
writer.start();