diff options
Diffstat (limited to '3rdparty/asio/src/tests/unit/strand.cpp')
-rw-r--r-- | 3rdparty/asio/src/tests/unit/strand.cpp | 94 |
1 files changed, 38 insertions, 56 deletions
diff --git a/3rdparty/asio/src/tests/unit/strand.cpp b/3rdparty/asio/src/tests/unit/strand.cpp index bf801049654..90ae2bc22a8 100644 --- a/3rdparty/asio/src/tests/unit/strand.cpp +++ b/3rdparty/asio/src/tests/unit/strand.cpp @@ -2,7 +2,7 @@ // strand.cpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2024 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) @@ -16,6 +16,7 @@ // Test that header file is self-contained. #include "asio/strand.hpp" +#include <functional> #include <sstream> #include "asio/executor.hpp" #include "asio/io_context.hpp" @@ -30,24 +31,13 @@ # include "asio/steady_timer.hpp" #endif // defined(ASIO_HAS_BOOST_DATE_TIME) -#if defined(ASIO_HAS_BOOST_BIND) -# include <boost/bind/bind.hpp> -#else // defined(ASIO_HAS_BOOST_BIND) -# include <functional> -#endif // defined(ASIO_HAS_BOOST_BIND) - using namespace asio; - -#if defined(ASIO_HAS_BOOST_BIND) -namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif #if defined(ASIO_HAS_BOOST_DATE_TIME) typedef deadline_timer timer; namespace chronons = boost::posix_time; -#elif defined(ASIO_HAS_CHRONO) +#else // defined(ASIO_HAS_BOOST_DATE_TIME) typedef steady_timer timer; namespace chronons = asio::chrono; #endif // defined(ASIO_HAS_BOOST_DATE_TIME) @@ -303,7 +293,7 @@ void strand_execute_test() strand<io_context::executor_type> s1 = make_strand(ioc); int count = 0; - asio::execution::execute(s1, bindns::bind(increment, &count)); + s1.execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. ASIO_CHECK(!ioc.stopped()); @@ -317,8 +307,7 @@ void strand_execute_test() count = 0; ioc.restart(); - asio::execution::execute( - asio::require(s1, asio::execution::blocking.possibly), + asio::require(s1, asio::execution::blocking.possibly).execute( bindns::bind(increment, &count)); // No handlers can be called until run() is called. @@ -333,8 +322,7 @@ void strand_execute_test() count = 0; ioc.restart(); - asio::execution::execute( - asio::require(s1, asio::execution::blocking.never), + asio::require(s1, asio::execution::blocking.never).execute( bindns::bind(increment, &count)); // No handlers can be called until run() is called. @@ -351,11 +339,10 @@ void strand_execute_test() ioc.restart(); ASIO_CHECK(!ioc.stopped()); - asio::execution::execute( - asio::require(s1, - asio::execution::blocking.never, - asio::execution::outstanding_work.tracked), - bindns::bind(increment, &count)); + asio::require(s1, + asio::execution::blocking.never, + asio::execution::outstanding_work.tracked + ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. ASIO_CHECK(!ioc.stopped()); @@ -369,11 +356,10 @@ void strand_execute_test() count = 0; ioc.restart(); - asio::execution::execute( - asio::require(s1, - asio::execution::blocking.never, - asio::execution::outstanding_work.untracked), - bindns::bind(increment, &count)); + asio::require(s1, + asio::execution::blocking.never, + asio::execution::outstanding_work.untracked + ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. ASIO_CHECK(!ioc.stopped()); @@ -387,12 +373,11 @@ void strand_execute_test() count = 0; ioc.restart(); - asio::execution::execute( - asio::require(s1, - asio::execution::blocking.never, - asio::execution::outstanding_work.untracked, - asio::execution::relationship.fork), - bindns::bind(increment, &count)); + asio::require(s1, + asio::execution::blocking.never, + asio::execution::outstanding_work.untracked, + asio::execution::relationship.fork + ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. ASIO_CHECK(!ioc.stopped()); @@ -406,12 +391,11 @@ void strand_execute_test() count = 0; ioc.restart(); - asio::execution::execute( - asio::require(s1, - asio::execution::blocking.never, - asio::execution::outstanding_work.untracked, - asio::execution::relationship.continuation), - bindns::bind(increment, &count)); + asio::require(s1, + asio::execution::blocking.never, + asio::execution::outstanding_work.untracked, + asio::execution::relationship.continuation + ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. ASIO_CHECK(!ioc.stopped()); @@ -425,14 +409,13 @@ void strand_execute_test() count = 0; ioc.restart(); - asio::execution::execute( - asio::prefer( - asio::require(s1, - asio::execution::blocking.never, - asio::execution::outstanding_work.untracked, - asio::execution::relationship.continuation), - asio::execution::allocator(std::allocator<void>())), - bindns::bind(increment, &count)); + asio::prefer( + asio::require(s1, + asio::execution::blocking.never, + asio::execution::outstanding_work.untracked, + asio::execution::relationship.continuation), + asio::execution::allocator(std::allocator<void>()) + ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. ASIO_CHECK(!ioc.stopped()); @@ -446,14 +429,13 @@ void strand_execute_test() count = 0; ioc.restart(); - asio::execution::execute( - asio::prefer( - asio::require(s1, - asio::execution::blocking.never, - asio::execution::outstanding_work.untracked, - asio::execution::relationship.continuation), - asio::execution::allocator), - bindns::bind(increment, &count)); + asio::prefer( + asio::require(s1, + asio::execution::blocking.never, + asio::execution::outstanding_work.untracked, + asio::execution::relationship.continuation), + asio::execution::allocator + ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. ASIO_CHECK(!ioc.stopped()); |