Bitcoin Core 29.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | List of all members
mp::AsyncCallable< Callable > Struct Template Reference

Wrapper around callback function for compatibility with std::async. More...

#include <util.h>

Public Member Functions

 AsyncCallable (Callable &&callable)
 
 AsyncCallable (const AsyncCallable &)=default
 
 AsyncCallable (AsyncCallable &&)=default
 
 ~AsyncCallable () noexcept=default
 
ResultOf< Callable > operator() () const
 

Public Attributes

std::shared_ptr< DestructorCatcher< Callable > > m_callable
 

Detailed Description

template<typename Callable>
struct mp::AsyncCallable< Callable >

Wrapper around callback function for compatibility with std::async.

std::async requires callbacks to be copyable and requires noexcept destructors, but this doesn't work well with kj types which are generally move-only and not noexcept.

Definition at line 170 of file util.h.

Constructor & Destructor Documentation

◆ AsyncCallable() [1/3]

template<typename Callable >
mp::AsyncCallable< Callable >::AsyncCallable ( Callable &&  callable)
inline

Definition at line 172 of file util.h.

◆ AsyncCallable() [2/3]

template<typename Callable >
mp::AsyncCallable< Callable >::AsyncCallable ( const AsyncCallable< Callable > &  )
default

◆ AsyncCallable() [3/3]

template<typename Callable >
mp::AsyncCallable< Callable >::AsyncCallable ( AsyncCallable< Callable > &&  )
default

◆ ~AsyncCallable()

template<typename Callable >
mp::AsyncCallable< Callable >::~AsyncCallable ( )
defaultnoexcept

Member Function Documentation

◆ operator()()

template<typename Callable >
ResultOf< Callable > mp::AsyncCallable< Callable >::operator() ( ) const
inline

Definition at line 178 of file util.h.

Member Data Documentation

◆ m_callable

template<typename Callable >
std::shared_ptr<DestructorCatcher<Callable> > mp::AsyncCallable< Callable >::m_callable
mutable

Definition at line 179 of file util.h.


The documentation for this struct was generated from the following file: