I'm using the raspberry pi pigpio module to communicate with two other devices at once using two separate threads. The devices are connected to two different pairs of gpio pins. I need to adhere to strict timing limits for the request response sequences between the pi and each of the two devices.
The only way I'm able to send a message to a device is to acquire a lock and block the other thread from sending any messages, because otherwise the threads interfere with each other in defining the waveform. But blocking a thread from sending a message significantly increases the risk of going over the time limit and messes up the sequence.
Is there a way for the two threads to send messages from the pi to the two devices completely independent of each other. In other words can I store define two separate chains of waveforms dedicated to each thread so they don't interfere?