]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/fiber/include/boost/fiber/future/detail/shared_state_object.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / fiber / include / boost / fiber / future / detail / shared_state_object.hpp
CommitLineData
7c673cae
FG
1
2// Copyright Oliver Kowalke 2013.
3// Distributed under the Boost Software License, Version 1.0.
4// (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7#ifndef BOOST_FIBERS_DETAIL_SHARED_STATE_OBJECT_H
8#define BOOST_FIBERS_DETAIL_SHARED_STATE_OBJECT_H
9
10#include <memory>
11
12#include <boost/config.hpp>
13
14#include <boost/fiber/detail/config.hpp>
15#include <boost/fiber/future/detail/shared_state.hpp>
16
17#ifdef BOOST_HAS_ABI_HEADERS
18# include BOOST_ABI_PREFIX
19#endif
20
21namespace boost {
22namespace fibers {
23namespace detail {
24
25template< typename R, typename Allocator >
26class shared_state_object : public shared_state< R > {
27public:
28 typedef typename std::allocator_traits< Allocator >::template rebind_alloc<
29 shared_state_object
30 > allocator_t;
31
32 shared_state_object( allocator_t const& alloc) :
33 shared_state< R >(), alloc_( alloc) {
34 }
35
36protected:
37 void deallocate_future() noexcept override final {
38 destroy_( alloc_, this);
39 }
40
41private:
42 allocator_t alloc_;
43
44 static void destroy_( allocator_t const& alloc, shared_state_object * p) noexcept {
45 allocator_t a{ alloc };
46 a.destroy( p);
47 a.deallocate( p, 1);
48 }
49};
50
51}}}
52
53#ifdef BOOST_HAS_ABI_HEADERS
54# include BOOST_ABI_SUFFIX
55#endif
56
57#endif // BOOST_FIBERS_DETAIL_SHARED_STATE_OBJECT_H