I tried to search for it, could not find the answer, searched here, could not find the answer. Has anyone ever wondered if it is safe to thread write a Serial () (pyserial) object from stream a and block reads from stream b?
I know how to use thread synchronization primitives and thread-safe data structures, and in fact my current form of this program has a read / write stream on the serial port, and I use thread-safe data structures to coordinate actions in the application.
My application would be very useful if I could write to the serial port from the main stream (and never read it), and read from the serial port using the lock, read in the second stream (and never write to it). If someone really wants me to go on why this is beneficial to the application, I can add my reasons. In my opinion, there will be only one instance of Serial (), and even if thread B sits in the lock read on the Serial object, thread A will be safe to use write methods in the Serial object.
Does anyone know if this Serial class can be used?
EDIT: It seems to me that the answer may be platform dependent. If you have experience with such a platform, it would be nice to know which platform you worked on.
EDIT: There was only one answer, but if someone else tried this, please leave an answer with your experience.
source share