/
usr
/
include
/
boost
/
asio
/
/usr/include/boost/asio
mkdir
upload
Name
Size
Mode
Actions
detail/
-
0755
rm
execution/
-
0755
rm
generic/
-
0755
rm
impl/
-
0755
rm
ip/
-
0755
rm
local/
-
0755
rm
posix/
-
0755
rm
ssl/
-
0755
rm
traits/
-
0755
rm
ts/
-
0755
rm
windows/
-
0755
rm
any_io_executor.hpp
2625
0644
edit
dl
rm
associated_allocator.hpp
3791
0644
edit
dl
rm
associated_executor.hpp
5057
0644
edit
dl
rm
async_result.hpp
19423
0644
edit
dl
rm
awaitable.hpp
3270
0644
edit
dl
rm
basic_datagram_socket.hpp
47521
0644
edit
dl
rm
basic_deadline_timer.hpp
24158
0644
edit
dl
rm
basic_io_object.hpp
8096
0644
edit
dl
rm
basic_raw_socket.hpp
46996
0644
edit
dl
rm
basic_seq_packet_socket.hpp
29184
0644
edit
dl
rm
basic_serial_port.hpp
31912
0644
edit
dl
rm
basic_signal_set.hpp
19876
0644
edit
dl
rm
basic_socket.hpp
65516
0644
edit
dl
rm
basic_socket_acceptor.hpp
88062
0644
edit
dl
rm
basic_socket_iostream.hpp
13298
0644
edit
dl
rm
basic_socket_streambuf.hpp
21713
0644
edit
dl
rm
basic_streambuf.hpp
13714
0644
edit
dl
rm
basic_streambuf_fwd.hpp
920
0644
edit
dl
rm
basic_stream_socket.hpp
41520
0644
edit
dl
rm
basic_waitable_timer.hpp
28528
0644
edit
dl
rm
bind_executor.hpp
16510
0644
edit
dl
rm
buffer.hpp
83254
0644
edit
dl
rm
buffered_read_stream.hpp
8424
0644
edit
dl
rm
buffered_read_stream_fwd.hpp
699
0644
edit
dl
rm
buffered_stream.hpp
9074
0644
edit
dl
rm
buffered_stream_fwd.hpp
669
0644
edit
dl
rm
buffered_write_stream.hpp
8042
0644
edit
dl
rm
buffered_write_stream_fwd.hpp
705
0644
edit
dl
rm
buffers_iterator.hpp
14049
0644
edit
dl
rm
completion_condition.hpp
5500
0644
edit
dl
rm
compose.hpp
4596
0644
edit
dl
rm
connect.hpp
43157
0644
edit
dl
rm
coroutine.hpp
9897
0644
edit
dl
rm
co_spawn.hpp
14509
0644
edit
dl
rm
deadline_timer.hpp
1138
0644
edit
dl
rm
defer.hpp
5070
0644
edit
dl
rm
detached.hpp
3517
0644
edit
dl
rm
dispatch.hpp
4537
0644
edit
dl
rm
error.hpp
10351
0644
edit
dl
rm
execution.hpp
1871
0644
edit
dl
rm
execution_context.hpp
14341
0644
edit
dl
rm
executor.hpp
10467
0644
edit
dl
rm
executor_work_guard.hpp
8039
0644
edit
dl
rm
handler_alloc_hook.hpp
3471
0644
edit
dl
rm
handler_continuation_hook.hpp
1474
0644
edit
dl
rm
handler_invoke_hook.hpp
3744
0644
edit
dl
rm
high_resolution_timer.hpp
1394
0644
edit
dl
rm
io_context.hpp
55226
0644
edit
dl
rm
io_context_strand.hpp
13706
0644
edit
dl
rm
io_service.hpp
861
0644
edit
dl
rm
io_service_strand.hpp
575
0644
edit
dl
rm
is_applicable_property.hpp
1605
0644
edit
dl
rm
is_executor.hpp
1306
0644
edit
dl
rm
is_read_buffered.hpp
1646
0644
edit
dl
rm
is_write_buffered.hpp
1667
0644
edit
dl
rm
multiple_exceptions.hpp
1631
0644
edit
dl
rm
packaged_task.hpp
3358
0644
edit
dl
rm
placeholders.hpp
4146
0644
edit
dl
rm
post.hpp
4760
0644
edit
dl
rm
prefer.hpp
18821
0644
edit
dl
rm
query.hpp
8323
0644
edit
dl
rm
read.hpp
53894
0644
edit
dl
rm
read_at.hpp
27766
0644
edit
dl
rm
read_until.hpp
119477
0644
edit
dl
rm
redirect_error.hpp
1938
0644
edit
dl
rm
require.hpp
14926
0644
edit
dl
rm
require_concept.hpp
9218
0644
edit
dl
rm
serial_port.hpp
1010
0644
edit
dl
rm
serial_port_base.hpp
4975
0644
edit
dl
rm
signal_set.hpp
748
0644
edit
dl
rm
socket_base.hpp
15939
0644
edit
dl
rm
spawn.hpp
11793
0644
edit
dl
rm
ssl.hpp
848
0644
edit
dl
rm
static_thread_pool.hpp
826
0644
edit
dl
rm
steady_timer.hpp
1306
0644
edit
dl
rm
strand.hpp
17193
0644
edit
dl
rm
streambuf.hpp
826
0644
edit
dl
rm
system_context.hpp
2649
0644
edit
dl
rm
system_executor.hpp
22529
0644
edit
dl
rm
system_timer.hpp
1306
0644
edit
dl
rm
this_coro.hpp
1149
0644
edit
dl
rm
thread_pool.hpp
37567
0644
edit
dl
rm
time_traits.hpp
2281
0644
edit
dl
rm
unyield.hpp
381
0644
edit
dl
rm
uses_executor.hpp
2348
0644
edit
dl
rm
use_awaitable.hpp
5821
0644
edit
dl
rm
use_future.hpp
4820
0644
edit
dl
rm
version.hpp
686
0644
edit
dl
rm
wait_traits.hpp
1451
0644
edit
dl
rm
write.hpp
52959
0644
edit
dl
rm
write_at.hpp
29514
0644
edit
dl
rm
yield.hpp
482
0644
edit
dl
rm
Edit:
/usr/include/boost/asio/io_context_strand.hpp
(13706B)
// // io_context_strand.hpp // ~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BOOST_ASIO_IO_CONTEXT_STRAND_HPP #define BOOST_ASIO_IO_CONTEXT_STRAND_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #if !defined(BOOST_ASIO_NO_EXTENSIONS) \ && !defined(BOOST_ASIO_NO_TS_EXECUTORS) #include <boost/asio/async_result.hpp> #include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/strand_service.hpp> #include <boost/asio/detail/wrapped_handler.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// Provides serialised handler execution. /** * The io_context::strand class provides the ability to post and dispatch * handlers with the guarantee that none of those handlers will execute * concurrently. * * @par Order of handler invocation * Given: * * @li a strand object @c s * * @li an object @c a meeting completion handler requirements * * @li an object @c a1 which is an arbitrary copy of @c a made by the * implementation * * @li an object @c b meeting completion handler requirements * * @li an object @c b1 which is an arbitrary copy of @c b made by the * implementation * * if any of the following conditions are true: * * @li @c s.post(a) happens-before @c s.post(b) * * @li @c s.post(a) happens-before @c s.dispatch(b), where the latter is * performed outside the strand * * @li @c s.dispatch(a) happens-before @c s.post(b), where the former is * performed outside the strand * * @li @c s.dispatch(a) happens-before @c s.dispatch(b), where both are * performed outside the strand * * then @c asio_handler_invoke(a1, &a1) happens-before * @c asio_handler_invoke(b1, &b1). * * Note that in the following case: * @code async_op_1(..., s.wrap(a)); * async_op_2(..., s.wrap(b)); @endcode * the completion of the first async operation will perform @c s.dispatch(a), * and the second will perform @c s.dispatch(b), but the order in which those * are performed is unspecified. That is, you cannot state whether one * happens-before the other. Therefore none of the above conditions are met and * no ordering guarantee is made. * * @note The implementation makes no guarantee that handlers posted or * dispatched through different @c strand objects will be invoked concurrently. * * @par Thread Safety * @e Distinct @e objects: Safe.@n * @e Shared @e objects: Safe. * * @par Concepts: * Dispatcher. */ class io_context::strand { public: /// Constructor. /** * Constructs the strand. * * @param io_context The io_context object that the strand will use to * dispatch handlers that are ready to be run. */ explicit strand(boost::asio::io_context& io_context) : service_(boost::asio::use_service< boost::asio::detail::strand_service>(io_context)) { service_.construct(impl_); } /// Destructor. /** * Destroys a strand. * * Handlers posted through the strand that have not yet been invoked will * still be dispatched in a way that meets the guarantee of non-concurrency. */ ~strand() { } /// Obtain the underlying execution context. boost::asio::io_context& context() const BOOST_ASIO_NOEXCEPT { return service_.get_io_context(); } /// Inform the strand that it has some outstanding work to do. /** * The strand delegates this call to its underlying io_context. */ void on_work_started() const BOOST_ASIO_NOEXCEPT { context().get_executor().on_work_started(); } /// Inform the strand that some work is no longer outstanding. /** * The strand delegates this call to its underlying io_context. */ void on_work_finished() const BOOST_ASIO_NOEXCEPT { context().get_executor().on_work_finished(); } /// Request the strand to invoke the given function object. /** * This function is used to ask the strand to execute the given function * object on its underlying io_context. The function object will be executed * inside this function if the strand is not otherwise busy and if the * underlying io_context's executor's @c dispatch() function is also able to * execute the function before returning. * * @param f The function object to be called. The executor will make * a copy of the handler object as required. The function signature of the * function object must be: @code void function(); @endcode * * @param a An allocator that may be used by the executor to allocate the * internal storage needed for function invocation. */ template <typename Function, typename Allocator> void dispatch(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const { typename decay<Function>::type tmp(BOOST_ASIO_MOVE_CAST(Function)(f)); service_.dispatch(impl_, tmp); (void)a; } #if !defined(BOOST_ASIO_NO_DEPRECATED) /// (Deprecated: Use boost::asio::dispatch().) Request the strand to invoke /// the given handler. /** * This function is used to ask the strand to execute the given handler. * * The strand object guarantees that handlers posted or dispatched through * the strand will not be executed concurrently. The handler may be executed * inside this function if the guarantee can be met. If this function is * called from within a handler that was posted or dispatched through the same * strand, then the new handler will be executed immediately. * * The strand's guarantee is in addition to the guarantee provided by the * underlying io_context. The io_context guarantees that the handler will only * be called in a thread in which the io_context's run member function is * currently being invoked. * * @param handler The handler to be called. The strand will make a copy of the * handler object as required. The function signature of the handler must be: * @code void handler(); @endcode */ template <typename LegacyCompletionHandler> BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ()) dispatch(BOOST_ASIO_MOVE_ARG(LegacyCompletionHandler) handler) { return async_initiate<LegacyCompletionHandler, void ()>( initiate_dispatch(), handler, this); } #endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// Request the strand to invoke the given function object. /** * This function is used to ask the executor to execute the given function * object. The function object will never be executed inside this function. * Instead, it will be scheduled to run by the underlying io_context. * * @param f The function object to be called. The executor will make * a copy of the handler object as required. The function signature of the * function object must be: @code void function(); @endcode * * @param a An allocator that may be used by the executor to allocate the * internal storage needed for function invocation. */ template <typename Function, typename Allocator> void post(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const { typename decay<Function>::type tmp(BOOST_ASIO_MOVE_CAST(Function)(f)); service_.post(impl_, tmp); (void)a; } #if !defined(BOOST_ASIO_NO_DEPRECATED) /// (Deprecated: Use boost::asio::post().) Request the strand to invoke the /// given handler and return immediately. /** * This function is used to ask the strand to execute the given handler, but * without allowing the strand to call the handler from inside this function. * * The strand object guarantees that handlers posted or dispatched through * the strand will not be executed concurrently. The strand's guarantee is in * addition to the guarantee provided by the underlying io_context. The * io_context guarantees that the handler will only be called in a thread in * which the io_context's run member function is currently being invoked. * * @param handler The handler to be called. The strand will make a copy of the * handler object as required. The function signature of the handler must be: * @code void handler(); @endcode */ template <typename LegacyCompletionHandler> BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ()) post(BOOST_ASIO_MOVE_ARG(LegacyCompletionHandler) handler) { return async_initiate<LegacyCompletionHandler, void ()>( initiate_post(), handler, this); } #endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// Request the strand to invoke the given function object. /** * This function is used to ask the executor to execute the given function * object. The function object will never be executed inside this function. * Instead, it will be scheduled to run by the underlying io_context. * * @param f The function object to be called. The executor will make * a copy of the handler object as required. The function signature of the * function object must be: @code void function(); @endcode * * @param a An allocator that may be used by the executor to allocate the * internal storage needed for function invocation. */ template <typename Function, typename Allocator> void defer(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const { typename decay<Function>::type tmp(BOOST_ASIO_MOVE_CAST(Function)(f)); service_.post(impl_, tmp); (void)a; } #if !defined(BOOST_ASIO_NO_DEPRECATED) /// (Deprecated: Use boost::asio::bind_executor().) Create a new handler that /// automatically dispatches the wrapped handler on the strand. /** * This function is used to create a new handler function object that, when * invoked, will automatically pass the wrapped handler to the strand's * dispatch function. * * @param handler The handler to be wrapped. The strand will make a copy of * the handler object as required. The function signature of the handler must * be: @code void handler(A1 a1, ... An an); @endcode * * @return A function object that, when invoked, passes the wrapped handler to * the strand's dispatch function. Given a function object with the signature: * @code R f(A1 a1, ... An an); @endcode * If this function object is passed to the wrap function like so: * @code strand.wrap(f); @endcode * then the return value is a function object with the signature * @code void g(A1 a1, ... An an); @endcode * that, when invoked, executes code equivalent to: * @code strand.dispatch(boost::bind(f, a1, ... an)); @endcode */ template <typename Handler> #if defined(GENERATING_DOCUMENTATION) unspecified #else detail::wrapped_handler<strand, Handler, detail::is_continuation_if_running> #endif wrap(Handler handler) { return detail::wrapped_handler<io_context::strand, Handler, detail::is_continuation_if_running>(*this, handler); } #endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// Determine whether the strand is running in the current thread. /** * @return @c true if the current thread is executing a handler that was * submitted to the strand using post(), dispatch() or wrap(). Otherwise * returns @c false. */ bool running_in_this_thread() const BOOST_ASIO_NOEXCEPT { return service_.running_in_this_thread(impl_); } /// Compare two strands for equality. /** * Two strands are equal if they refer to the same ordered, non-concurrent * state. */ friend bool operator==(const strand& a, const strand& b) BOOST_ASIO_NOEXCEPT { return a.impl_ == b.impl_; } /// Compare two strands for inequality. /** * Two strands are equal if they refer to the same ordered, non-concurrent * state. */ friend bool operator!=(const strand& a, const strand& b) BOOST_ASIO_NOEXCEPT { return a.impl_ != b.impl_; } private: #if !defined(BOOST_ASIO_NO_DEPRECATED) struct initiate_dispatch { template <typename LegacyCompletionHandler> void operator()(BOOST_ASIO_MOVE_ARG(LegacyCompletionHandler) handler, strand* self) const { // If you get an error on the following line it means that your // handler does not meet the documented type requirements for a // LegacyCompletionHandler. BOOST_ASIO_LEGACY_COMPLETION_HANDLER_CHECK( LegacyCompletionHandler, handler) type_check; detail::non_const_lvalue<LegacyCompletionHandler> handler2(handler); self->service_.dispatch(self->impl_, handler2.value); } }; struct initiate_post { template <typename LegacyCompletionHandler> void operator()(BOOST_ASIO_MOVE_ARG(LegacyCompletionHandler) handler, strand* self) const { // If you get an error on the following line it means that your // handler does not meet the documented type requirements for a // LegacyCompletionHandler. BOOST_ASIO_LEGACY_COMPLETION_HANDLER_CHECK( LegacyCompletionHandler, handler) type_check; detail::non_const_lvalue<LegacyCompletionHandler> handler2(handler); self->service_.post(self->impl_, handler2.value); } }; #endif // !defined(BOOST_ASIO_NO_DEPRECATED) boost::asio::detail::strand_service& service_; mutable boost::asio::detail::strand_service::implementation_type impl_; }; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) // && !defined(BOOST_ASIO_NO_TS_EXECUTORS) #endif // BOOST_ASIO_IO_CONTEXT_STRAND_HPP
Save
cmd:
run