Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does boost::asio::io_service preserve the order of handlers?

Does boost::asio::io_service guarantee that handlers are called in the same order that they are given via post()? I can't find anything saying this in the documentation. Assume that calls to io_service::post are serialized.

like image 430
jakar Avatar asked Jun 22 '11 15:06

jakar


2 Answers

The current implementation does execute things in the sequence you post them, but ordering is only guaranteed for handlers that are explicitly post()ed through a strand.

like image 195
Alok Save Avatar answered Nov 15 '22 21:11

Alok Save


afaik if you want guaranteed ordering of post handler execution you have to use strand as described in the docs.

like image 43
Steve Townsend Avatar answered Nov 15 '22 20:11

Steve Townsend