Use multiple threads
fsau opened this issue · 0 comments
fsau commented
The code mainly operates in a infinite loop that waits some time for the data to be received then translates it in several options (or does nothing if it didn't received any data, only counts), sending the appropriate commands to uinput
. I think it would be better in 3 threads:
- serial thread: wait for partial data on serial port (blocking), add partial data to buffer, if data is valid, transfer orderly to serial_output buffer
- main thread: wait for data on serial_output buffer, translate it and send to uinput buffer, check for timings
- uinput thread: wait for data on uinput buffer, send to uinput device