title: OpenSSL SSL_read and SSL_write from multiple threads
body: <p>I know it is forbidden in the OpenSSL API to call <code>SSL_read</code> and <code>SSL_write</code> from two different threads on the same <code>SSL</code> context, but it's important in my application to have secure full-duplex communication.  I thought of some solutions, none of which I really like:</p>
  
  <ol>
  <li>Use two <code>SSL</code> contexts per connection.  I don't like this because it uses more resources, and it would complicate my implementation.  However, I would be fine using this if I could just "duplicate" an existing <code>SSL</code> context rather than creating a whole new connection from scratch.</li>
  <li>Use non-blocking sockets with a mutex controlling access to an <code>SSL</code> context.  This would require resource-hogging polling, and I heard the non-blocking implementation is just not very good.</li>
  </ol>
  
  <p>This seems like it would be a rather common thing to do, so what is an accepted solution to this problem?</p>