Add shallow-constness to strands.

This commit is contained in:
Christopher Kohlhoff 2017-03-17 16:27:25 +11:00
parent 00a85845ec
commit e5acea17d7
2 changed files with 13 additions and 13 deletions

View File

@ -144,7 +144,7 @@ public:
#endif // !defined(ASIO_NO_DEPRECATED)
/// Obtain the underlying execution context.
asio::io_context& context() ASIO_NOEXCEPT
asio::io_context& context() const ASIO_NOEXCEPT
{
return service_.get_io_context();
}
@ -153,7 +153,7 @@ public:
/**
* The strand delegates this call to its underlying io_context.
*/
void on_work_started() ASIO_NOEXCEPT
void on_work_started() const ASIO_NOEXCEPT
{
context().get_executor().on_work_started();
}
@ -162,7 +162,7 @@ public:
/**
* The strand delegates this call to its underlying io_context.
*/
void on_work_finished() ASIO_NOEXCEPT
void on_work_finished() const ASIO_NOEXCEPT
{
context().get_executor().on_work_finished();
}
@ -183,7 +183,7 @@ public:
* internal storage needed for function invocation.
*/
template <typename Function, typename Allocator>
void dispatch(ASIO_MOVE_ARG(Function) f, const Allocator& a)
void dispatch(ASIO_MOVE_ARG(Function) f, const Allocator& a) const
{
typename decay<Function>::type tmp(ASIO_MOVE_CAST(Function)(f));
service_.dispatch(impl_, tmp);
@ -241,7 +241,7 @@ public:
* internal storage needed for function invocation.
*/
template <typename Function, typename Allocator>
void post(ASIO_MOVE_ARG(Function) f, const Allocator& a)
void post(ASIO_MOVE_ARG(Function) f, const Allocator& a) const
{
typename decay<Function>::type tmp(ASIO_MOVE_CAST(Function)(f));
service_.post(impl_, tmp);
@ -295,7 +295,7 @@ public:
* internal storage needed for function invocation.
*/
template <typename Function, typename Allocator>
void defer(ASIO_MOVE_ARG(Function) f, const Allocator& a)
void defer(ASIO_MOVE_ARG(Function) f, const Allocator& a) const
{
typename decay<Function>::type tmp(ASIO_MOVE_CAST(Function)(f));
service_.post(impl_, tmp);
@ -370,7 +370,7 @@ public:
private:
asio::detail::strand_service& service_;
asio::detail::strand_service::implementation_type impl_;
mutable asio::detail::strand_service::implementation_type impl_;
};
} // namespace asio

View File

@ -148,7 +148,7 @@ public:
}
/// Obtain the underlying execution context.
execution_context& context() ASIO_NOEXCEPT
execution_context& context() const ASIO_NOEXCEPT
{
return executor_.context();
}
@ -157,7 +157,7 @@ public:
/**
* The strand delegates this call to its underlying executor.
*/
void on_work_started() ASIO_NOEXCEPT
void on_work_started() const ASIO_NOEXCEPT
{
executor_.on_work_started();
}
@ -166,7 +166,7 @@ public:
/**
* The strand delegates this call to its underlying executor.
*/
void on_work_finished() ASIO_NOEXCEPT
void on_work_finished() const ASIO_NOEXCEPT
{
executor_.on_work_finished();
}
@ -187,7 +187,7 @@ public:
* internal storage needed for function invocation.
*/
template <typename Function, typename Allocator>
void dispatch(ASIO_MOVE_ARG(Function) f, const Allocator& a)
void dispatch(ASIO_MOVE_ARG(Function) f, const Allocator& a) const
{
detail::strand_executor_service::dispatch(impl_,
executor_, ASIO_MOVE_CAST(Function)(f), a);
@ -207,7 +207,7 @@ public:
* internal storage needed for function invocation.
*/
template <typename Function, typename Allocator>
void post(ASIO_MOVE_ARG(Function) f, const Allocator& a)
void post(ASIO_MOVE_ARG(Function) f, const Allocator& a) const
{
detail::strand_executor_service::post(impl_,
executor_, ASIO_MOVE_CAST(Function)(f), a);
@ -227,7 +227,7 @@ public:
* internal storage needed for function invocation.
*/
template <typename Function, typename Allocator>
void defer(ASIO_MOVE_ARG(Function) f, const Allocator& a)
void defer(ASIO_MOVE_ARG(Function) f, const Allocator& a) const
{
detail::strand_executor_service::defer(impl_,
executor_, ASIO_MOVE_CAST(Function)(f), a);