From b12241f6b67da0918c26fc3c1fdb7383d7298737 Mon Sep 17 00:00:00 2001 From: Klemens Morgenstern Date: Tue, 24 Oct 2023 10:02:06 +0800 Subject: [PATCH] more link fixes. --- CMakeLists.txt | 5 ++++- include/boost/cobalt/thread.hpp | 15 +++++++++++---- test/Jamfile.jam | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae876ca4..d9d0f46f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,6 @@ endif() option(BOOST_COBALT_USE_BOOST_CONTAINER "Use boost.container instead of std::pmr" ${BOOST_COBALT_SHOULD_USE_CONTAINER}) - if (NOT BOOST_COBALT_IS_ROOT) # Generated by `boostdep --cmake cobalt` # Copyright 2020, 2021 Peter Dimov @@ -66,6 +65,10 @@ if (NOT BOOST_COBALT_IS_ROOT) ) target_compile_features(boost_cobalt PUBLIC cxx_std_20) + if (MSVC) + target_compile_definitions(boost_cobalt PUBLIC _WIN32_WINNT=0x0601) + endif() + if (BOOST_COBALT_USE_BOOST_CONTAINER) target_link_libraries(boost_cobalt PUBLIC Boost::container) target_compile_definitions(boost_cobalt PUBLIC BOOST_COBALT_USE_BOOST_CONTAINER_PMR=1 ) diff --git a/include/boost/cobalt/thread.hpp b/include/boost/cobalt/thread.hpp index 1b172b87..2150789c 100644 --- a/include/boost/cobalt/thread.hpp +++ b/include/boost/cobalt/thread.hpp @@ -22,10 +22,7 @@ struct thread // Send a cancellation signal void cancel(asio::cancellation_type type = asio::cancellation_type::all); - // Add the functions similar to `std::thread` - void join(); - bool joinable() const; - void detach(); + // Allow the thread to be awaited. NOOP if the thread is invalid. auto operator co_await() &-> detail::thread_awaitable; //<1> auto operator co_await() && -> detail::thread_awaitable; //<2> @@ -42,9 +39,19 @@ struct thread // end::outline[] /* tag::outline[] + // Add the functions similar to `std::thread` + void join(); + bool joinable() const; + void detach(); + executor_type get_executor() const; end::outline[] */ + + BOOST_COBALT_DECL void join(); + BOOST_COBALT_DECL bool joinable() const; + BOOST_COBALT_DECL void detach(); + executor_type get_executor(const boost::source_location & loc = BOOST_CURRENT_LOCATION) const { auto st = state_; diff --git a/test/Jamfile.jam b/test/Jamfile.jam index 429dfaea..450c8ea4 100644 --- a/test/Jamfile.jam +++ b/test/Jamfile.jam @@ -20,7 +20,7 @@ project : requirements import testing ; -lib test_impl : test_main.cpp /boost//cobalt : +lib test_impl : test_main.cpp /boost//cobalt /boost//unit_test_framework : static ;