I have a serial port access class which wraps the termios API. This serial port in some situations is used in a multithreaded environment. In this case it will be shared by 2 threads but I can guarantee that 1 will perform output only, and the other will perform input only. Does this require a mutex to access the object?
I can't find any documentation on the thread-safety of read(2) and write(2), or termios(3). I guess it really depends on the implementation, but given that read, write and the termios API are POSIX-compliant, does anyone know if POSIX specifies the thread-safety of these functions?