Thread are two threads in my application and one thread is called Reader and another one is Writer. The Reader thread calls the SSL_read function to receive the incoming data from the SSL socket connection; and the Writer thread invokes the SSL_write function to send out the data to the same SSL connection. In order to prevent Reader and Writer thread access the same SSL connection at the same time, I have placed a mutex to avoid this situation.
My question is that if my Reader thread gets a SSL_ERROR_WANT_WRITE error from SSL_read function call, can my Writer thread do the SSL_write operation right after the Reader's SSL_read operation? Or, if my Writer thread gets a SSL_ERROR_WANT_READ error from SSL_write call, can my Reader thread do the SSL_read just following the Writer's SSL_write operation? Basically is that ok to mix the SSL_read and SSL_write function by two different threads regardless the returning error code? Thank you for your time! Bob