From 3f7f2572b0dcebee03d08508e23b4c039ef5add5 Mon Sep 17 00:00:00 2001 From: Richard Hodges Date: Tue, 16 Aug 2022 10:26:23 +0200 Subject: [PATCH] Workaround TSAN CI bug fix #2499 --- CHANGELOG.md | 4 ++++ .../include/boost/beast/test/yield_to.hpp | 22 ++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0029d33..4841dd19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +* Workaround TSAN CI bug. + +-------------------------------------------------------------------------------- + Version 332: * Fix beast::zlib warnings diff --git a/test/extras/include/boost/beast/test/yield_to.hpp b/test/extras/include/boost/beast/test/yield_to.hpp index b6571ebd..145e889d 100644 --- a/test/extras/include/boost/beast/test/yield_to.hpp +++ b/test/extras/include/boost/beast/test/yield_to.hpp @@ -122,15 +122,21 @@ void enable_yield_to:: spawn(F0&& f, FN&&... fn) { - asio::spawn(ioc_, - [&](yield_context yield) + // dispatch of spawn is a workaround for + // https://github.com/boostorg/beast/issues/2499 + asio::dispatch(ioc_, + [&] { - f(yield); - std::lock_guard lock{m_}; - if(--running_ == 0) - cv_.notify_all(); - } - , boost::coroutines::attributes(2 * 1024 * 1024)); + asio::spawn(ioc_, + [&](yield_context yield) + { + f(yield); + std::lock_guard lock{m_}; + if(--running_ == 0) + cv_.notify_all(); + } + , boost::coroutines::attributes(2 * 1024 * 1024)); + }); spawn(fn...); }