/tmp/bitcoin/src/ipc/libmultiprocess/include/mp/type-threadmap.h
Line | Count | Source |
1 | | // Copyright (c) The Bitcoin Core developers |
2 | | // Distributed under the MIT software license, see the accompanying |
3 | | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
4 | | |
5 | | #ifndef MP_PROXY_TYPE_THREADMAP_H |
6 | | #define MP_PROXY_TYPE_THREADMAP_H |
7 | | |
8 | | #include <mp/util.h> |
9 | | |
10 | | namespace mp { |
11 | | template <> |
12 | | struct ProxyServer<ThreadMap> final : public virtual ThreadMap::Server |
13 | | { |
14 | | public: |
15 | | ProxyServer(Connection& connection); |
16 | | kj::Promise<void> makeThread(MakeThreadContext context) override; |
17 | | Connection& m_connection; |
18 | | }; |
19 | | |
20 | | template <typename Output> |
21 | | void CustomBuildField(TypeList<>, |
22 | | Priority<1>, |
23 | | InvokeContext& invoke_context, |
24 | | Output&& output, |
25 | | typename std::enable_if<std::is_same<decltype(output.get()), ThreadMap::Client>::value>::type* enable = nullptr) |
26 | 20 | { |
27 | 20 | output.set(kj::heap<ProxyServer<ThreadMap>>(invoke_context.connection)); |
28 | 20 | } void mp::CustomBuildField<mp::StructField<mp::Accessor<mp::init_fields::ThreadMap, 19>, capnp::Request<ipc::capnp::messages::Init::ConstructParams, ipc::capnp::messages::Init::ConstructResults>>>(mp::TypeList<>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::init_fields::ThreadMap, 19>, capnp::Request<ipc::capnp::messages::Init::ConstructParams, ipc::capnp::messages::Init::ConstructResults>>&&, std::enable_if<std::is_same<decltype(fp2.get()), mp::ThreadMap::Client>::value, void>::type*) Line | Count | Source | 26 | 10 | { | 27 | 10 | output.set(kj::heap<ProxyServer<ThreadMap>>(invoke_context.connection)); | 28 | 10 | } |
void mp::CustomBuildField<mp::StructField<mp::Accessor<mp::init_fields::ThreadMap, 19>, ipc::capnp::messages::Init::ConstructResults::Builder>>(mp::TypeList<>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::init_fields::ThreadMap, 19>, ipc::capnp::messages::Init::ConstructResults::Builder>&&, std::enable_if<std::is_same<decltype(fp2.get()), mp::ThreadMap::Client>::value, void>::type*) Line | Count | Source | 26 | 10 | { | 27 | 10 | output.set(kj::heap<ProxyServer<ThreadMap>>(invoke_context.connection)); | 28 | 10 | } |
|
29 | | |
30 | | template <typename Input> |
31 | | decltype(auto) CustomReadField(TypeList<>, |
32 | | Priority<1>, |
33 | | InvokeContext& invoke_context, |
34 | | Input&& input, |
35 | | typename std::enable_if<std::is_same<decltype(input.get()), ThreadMap::Client>::value>::type* enable = nullptr) |
36 | 20 | { |
37 | 20 | invoke_context.connection.m_thread_map = input.get(); |
38 | 20 | } decltype(auto) mp::CustomReadField<mp::StructField<mp::Accessor<mp::init_fields::ThreadMap, 19>, capnp::Response<ipc::capnp::messages::Init::ConstructResults>>>(mp::TypeList<>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::init_fields::ThreadMap, 19>, capnp::Response<ipc::capnp::messages::Init::ConstructResults>>&&, std::enable_if<std::is_same<decltype(fp2.get()), mp::ThreadMap::Client>::value, void>::type*) Line | Count | Source | 36 | 10 | { | 37 | 10 | invoke_context.connection.m_thread_map = input.get(); | 38 | 10 | } |
decltype(auto) mp::CustomReadField<mp::StructField<mp::Accessor<mp::init_fields::ThreadMap, 19>, ipc::capnp::messages::Init::ConstructParams::Reader const> const&>(mp::TypeList<>, mp::Priority<1>, mp::InvokeContext&, mp::StructField<mp::Accessor<mp::init_fields::ThreadMap, 19>, ipc::capnp::messages::Init::ConstructParams::Reader const> const&, std::enable_if<std::is_same<decltype(fp2.get()), mp::ThreadMap::Client>::value, void>::type*) Line | Count | Source | 36 | 10 | { | 37 | 10 | invoke_context.connection.m_thread_map = input.get(); | 38 | 10 | } |
|
39 | | } // namespace mp |
40 | | |
41 | | #endif // MP_PROXY_TYPE_THREADMAP_H |