1// Copyright (c) 2023 Klemens D. Morgenstern
2//
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#include <boost/cobalt/detail/util.hpp>
7
8#include <boost/cobalt/this_thread.hpp>
9#include <boost/cobalt/unique_handle.hpp>
10
11#include <boost/asio/bind_allocator.hpp>
12#include <boost/asio/post.hpp>
13
14namespace boost::cobalt::detail
15{
16
17#if BOOST_COBALT_NO_SELF_DELETE
18
19void self_destroy(std::coroutine_handle<void> h, const cobalt::executor & exec) noexcept
20{
21 asio::post(exec,
22 asio::bind_allocator(
23 this_thread::get_allocator(),
24 [del=unique_handle<void>(h.address())]() mutable
25 {
26 }));
27}
28#endif
29
30}
31

source code of boost/libs/cobalt/src/detail/util.cpp