From: Richard Hodges (hodges.r_at_[hidden])
Date: 2020-09-07 10:12:13
If your implementation is single threaded, you don't need to worry about
concurrency issues at all. All completion handlers will be scheduled to run
In other words, no need for a mutex.
If you later decide to make your program multi-threaded (i.e. multiple
threads per io_context) then the idiomatic method to control concurrency is
to use an asio::strand<asio::any_io_executor> as your executor type for
each io_enabled concern (such as a connection).
In asio, (and net.ts) the strand is a special executor adapter that
guarantees that although multiple completion handlers can execute
concurrently through the *underlying executor*, they can only complete
*sequentially* through the strand which is *adapting* that underlying
On Mon, 7 Sep 2020 at 11:54, Jupiter via Boost <boost_at_[hidden]>
> I used boost::asio::io_service for a single thread implementation but
> with multiple boost::asio::deadline_timer objects, because it is a
> single thread, I don't think I need to use boost::mutex to lock and
> unlock tasks running by deadline_timer, am I wrong about it?
> Thank you.
> Kind regards,
> Unsubscribe & other changes:
-- Richard Hodges hodges.r_at_[hidden] office: +442032898513 home: +376841522 mobile: +376380212
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk