What if the asio :: strand destructor is called, are there ready / broken handlers on this chain?

What if the destructor is called asio::strand, there are still some ready / broken handlers on this chain?

In the documentation:

Handlers sent through a chain that have not yet been called will still be sent in such a way as to guarantee a non-concurrency.

Does this mean that he will still call all the handlers, including expecting that ready-made handlers will not be ready, just as if they had not been destroyed (perhaps if you did not accept new handlers)?

Or maybe I am conceptually mistaken about the "idle handler" - the async operation will not send the handler to the chain until it is completed? If the target chain destructor is called, will this asynchronous operation be aware of this?

+4
source share
1 answer

From the documentation :

Handlers are sent through strandthat have not yet been called, they will be sent to continue so as to ensure that the guarantee is not concurrency.

, strand , , . , io_service, io_service. , , strand, .

, strand, . , API strand. strand , , strand::wrap():

async_op(..., s.wrap(a));

async_op() , , s.wrap(a). , a, strand, , s. strand , async_op() s.

io_service, strand, , . :

, io_service strand, .


, strand , io_service , strand API, strand. strand strand, strand strand s. strand strand. , remarks:

, , strand, .

Boost.Asio strand s strand. , BOOST_ASIO_STRAND_IMPLEMENTATIONS . strand strand, strand, .

+5

Source: https://habr.com/ru/post/1541716/


All Articles