Attemped to implement the multi-thread version of get_input_states() to increase speed, but it turned out to be slower. It was very fast already even when retrieving data sequentially because most of the time was spent in the wait() function. While waiting for the first Teensy's sensor response, the next one is actually ready already since all Teensy thread's work in parallel. Additional threads in the multithread mode might have slowed down the Teensy Thread.
Change to lock style "with" which acquire and release lock automatically. Also, only acquire lock when reading a variable that is also read by other thread. This reduce time when other threads waiting on the lock.