BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
3 #define FC_CONTEXT_STACK_SIZE (2048*1024)
36 virtual void busy() = 0;
58 const string&
name()
const;
76 void debug(
const std::string& d );
86 template<
typename Functor>
88 typedef decltype(f()) Result;
89 typedef typename std::remove_const_t< std::remove_reference_t<Functor> > FunctorType;
90 typename task<Result,
sizeof(FunctorType)>::ptr tsk =
91 task<Result,
sizeof(FunctorType)>::create( std::forward<Functor>(f), desc );
94 async_task(tsk.get(),prio);
109 template<
typename Functor>
112 typedef decltype(f()) Result;
113 typename task<Result,
sizeof(Functor)>::ptr tsk =
114 task<Result,
sizeof(Functor)>::create( std::forward<Functor>(f), desc );
117 async_task(tsk.get(),prio,when);
149 template<
typename T1,
typename T2>
151 std::vector<fc::promise_base::ptr> proms(2);
152 proms[0] = std::static_pointer_cast<fc::promise_base>(f1.m_prom);
153 proms[1] = std::static_pointer_cast<fc::promise_base>(f2.m_prom);
180 void yield(
bool reschedule=
true);
188 void notify_task_has_been_canceled();
219 template<
typename T1,
typename T2>
224 int wait_any_until( std::vector<promise_base::ptr>&& v,
const time_point& tp );
226 template<
typename Functor>
230 template<
typename Functor>
240 template<
typename Functor>
246 typedef decltype(f()) Result;
254 struct _EXCEPTION_POINTERS;
270 typedef int (*unhandled_exception_filter_type)(unsigned, _EXCEPTION_POINTERS*);
271 void set_unhandled_structured_exception_filter(unhandled_exception_filter_type new_filter);
272 unhandled_exception_filter_type get_unhandled_structured_exception_filter();
static thread & current()
a placeholder for the result of an asynchronous operation.
thread(const std::string &name="", thread_idle_notifier *notifier=0)
void * get_task_specific_data(unsigned slot)
void set_name(const string &n)
associates a name with this thread.
int wait_any_until(std::vector< promise_base::ptr > &&v, const time_point &tp)
void set_task_specific_data(unsigned slot, void *new_value, void(*cleanup)(void *))
unsigned get_next_unused_task_storage_slot()
auto schedule(Functor &&f, const fc::time_point &when, const char *desc FC_TASK_NAME_DEFAULT_ARG, priority prio=priority()) -> fc::future< decltype(f())>
void debug(const std::string &d)
print debug info about the state of every context / promise.
auto schedule(Functor &&f, const fc::time_point &t, const char *desc FC_TASK_NAME_DEFAULT_ARG, priority prio=priority()) -> fc::future< decltype(f())>
void usleep(const microseconds &u)
static microseconds maximum()
virtual task_base * idle()=0
const char * current_task_desc() const
void * get_thread_specific_data(unsigned slot)
friend void sleep_until(const time_point &)
priority current_priority() const
#define FC_TASK_NAME_DEFAULT_ARG
auto async(Functor &&f, const char *desc FC_TASK_NAME_DEFAULT_ARG, priority prio=priority()) -> fc::future< decltype(f())>
auto sync_call(thread *t, Functor &&f, const char *desc FC_TASK_NAME_DEFAULT_ARG, priority prio=priority()) -> decltype(f())
virtual ~thread_idle_notifier()
int wait_any(const fc::future< T1 > &f1, const fc::future< T2 > &f2, const microseconds &timeout_us=microseconds::maximum())
const T & wait(const microseconds &timeout=microseconds::maximum()) const
thread & operator=(thread &&t)=delete
std::shared_ptr< promise_base > ptr
auto async(Functor &&f, const char *desc FC_TASK_NAME_DEFAULT_ARG, priority prio=priority()) -> fc::future< decltype(f())>
void set_thread_specific_data(unsigned slot, void *new_value, void(*cleanup)(void *))
int wait_any(const fc::future< T1 > &f1, const fc::future< T2 > &f2, const microseconds timeout_us=microseconds::maximum())
void sleep_until(const time_point &tp)
const string & name() const
returns the name given by set_name() for this thread
friend int wait_any_until(std::vector< promise_base::ptr > &&v, const time_point &tp)
friend void usleep(const microseconds &)