BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
7 #include <boost/atomic.hpp>
91 std::shared_ptr<promise_base> _self;
92 boost::atomic<int32_t> _retain_count;
98 static void destroy(
void* v ) { ((T*)v)->~T(); }
102 static void run(
void* functor,
void* prom ) {
103 ((
promise<decltype((*((T*)functor))())>*)prom)->set_value( (*((T*)functor))() );
108 static void run(
void* functor,
void* prom ) {
115 template<
typename R,u
int64_t FunctorSize=64>
118 typedef std::shared_ptr<task<R,FunctorSize>>
ptr;
122 template<
typename Functor>
129 template<
typename Functor>
131 typedef typename std::remove_const_t< std::remove_reference_t<Functor> > FunctorType;
132 static_assert(
sizeof(f) <=
sizeof(_functor),
"sizeof(Functor) is larger than FunctorSize" );
133 new ((
char*)&_functor) FunctorType( std::forward<Functor>(f) );
140 alignas(double)
char _functor[FunctorSize];
143 template<u
int64_t FunctorSize>
146 typedef std::shared_ptr<task<void,FunctorSize>>
ptr;
150 template<
typename Functor>
157 template<
typename Functor>
159 typedef typename std::remove_const_t< std::remove_reference_t<Functor> > FunctorType;
160 static_assert(
sizeof(f) <=
sizeof(_functor),
"sizeof(Functor) is larger than FunctorSize" );
161 new ((
char*)&_functor) FunctorType( std::forward<Functor>(f) );
168 alignas(double)
char _functor[FunctorSize];
context * _active_context
uint64_t _posted_num
Task priority looks like unsupported feature.
virtual void cancel(const char *reason FC_CANCELATION_REASON_DEFAULT_ARG) override
void * get_task_specific_data(unsigned slot)
std::shared_ptr< task< R, FunctorSize > > ptr
void set_task_specific_data(unsigned slot, void *new_value, void(*cleanup)(void *))
static ptr create(Functor &&f, const char *desc)
#define FC_CANCELATION_REASON_DEFAULT_ARG
virtual void cancel(const char *reason FC_CANCELATION_REASON_DEFAULT_ARG) override
virtual void cancel(const char *reason FC_CANCELATION_REASON_DEFAULT_ARG) override
void cleanup_task_specific_data()
void _set_active_context(context *)
fwd< spin_lock, 8 > _spinlock
static ptr create(Functor &&f, const char *desc)
void(* _destroy_functor)(void *)
static void run(void *functor, void *prom)
std::shared_ptr< promise_base > ptr
specific_data_info(void *value, void(*cleanup)(void *))
std::shared_ptr< task< void, FunctorSize > > ptr
static void destroy(void *v)
void(* _run_functor)(void *, void *)
static void run(void *functor, void *prom)
std::vector< detail::specific_data_info > * _task_specific_data
Used to forward declare value types.