Skip to content

Commit ad2dc36

Browse files
committed
Add chaser_validate::parallel<> helper and use common macro.
1 parent d22a8dd commit ad2dc36

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

include/bitcoin/node/chasers/chaser.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@ class BCN_API chaser
163163
#define SUBSCRIBE_EVENTS(method, ...) \
164164
subscribe_events(BIND(method, __VA_ARGS__))
165165

166-
#define PARALLEL(method, ...) \
167-
boost::asio::post(threadpool_.service(), BIND(method, __VA_ARGS__));
168-
169166
} // namespace node
170167
} // namespace libbitcoin
171168

include/bitcoin/node/chasers/chaser_validate.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ class BCN_API chaser_validate
4242
void stop() NOEXCEPT override;
4343

4444
protected:
45+
/// Post a method in base or derived class in parallel (use PARALLEL).
46+
template <class Derived, typename Method, typename... Args>
47+
inline auto parallel(Method&& method, Args&&... args) NOEXCEPT
48+
{
49+
return boost::asio::post(threadpool_.service(),
50+
BIND_THIS(method, args));
51+
}
52+
4553
typedef network::race_unity<const code&, const database::tx_link&> race;
4654

4755
virtual bool handle_event(const code& ec, chase event_,

0 commit comments

Comments
 (0)