c++ - boost asio - SSL async_read and async_write from one thread -


i know openssl, boost asio ssl implementation based on, doesn't allow concurrent ssl_read() , ssl_write() (i.e. ssl_read() , ssl_write() executed different threads).

is safe call boost asio async_read() , async_write() on ssl socket same thread?

thanks

the requirement boost::asio::ssl:::stream thread safety; not place requirement thread may initiate operations:

distinct objects: safe.

shared objects: unsafe. application must ensure asynchronous operations performed within same implicit or explicit strand.

if application has 1 thread processing io_service, , async_read() , async_write() initiated within thread, safe, operation , completion handler(s) running within implicit strand.

on other hand, if multiple threads processing io_service, explicit strand necessary. async_read() , async_write() operations need initiated within strand, , completion handlers need wrapped same strand.

for more details on boost.asio's thread safety requirements, strands, , composed operations, consider reading this answer.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -