how to complete non-blocking IO with multiple worker threads ?
Environment: Linux (Fedora/RHEL)
I have a client server implementation with the server waiting for connections via an epoll fd. Many worker threads epoll_wait( ) on the epoll fd.
This implementation has the static thread-id and thread-locking callbacks registered to handle multiple threads to use the SSL API. However, the current implementation also spawns a dedicated thread to SSL_accept( )/SSL_connect( )/SSL_read( )/SSL_write( ) with SSL connections and works perfectly.
I want to discard the dedicated thread implementation for SSL and use the worker threads waiting in epoll_wait( ) to service the non-blocking IO requests as is done for non-SSL communication, using the SSL API of course. Can this be done ?
So, is there a way that such a multi-threaded non-blocking IO client/server application can complete the IO via various worker threads when a WANT_READ/WANT_WRITE is returned by SSL_get_error( )
Also, can WANT_READ/WANT_WRITE returned from SSL_accept( )/SSL_connect( ) also be serviced with non-blocking IO and via different worker threads ?
I couldn't find anything pertaining to this in the archives. Please point me to one if I missed it.