#include <thread.hpp>
Definition at line 39 of file thread.hpp.
◆ thread() [1/2]
◆ thread() [2/2]
fc::thread::thread |
( |
thread && |
m | ) |
|
|
delete |
◆ ~thread()
◆ async()
template<typename Functor >
auto fc::thread::async |
( |
Functor && |
f, |
|
|
const char *desc |
FC_TASK_NAME_DEFAULT_ARG, |
|
|
priority |
prio = priority() |
|
) |
| -> fc::future<decltype(f())> |
|
inline |
Calls function f
in this thread and returns a future<T> that can be used to wait on the result.
- Parameters
-
f | the operation to perform |
prio | the priority relative to other tasks |
Definition at line 87 of file thread.hpp.
◆ cleanup()
void fc::thread::cleanup |
( |
| ) |
|
|
static |
◆ current()
thread & fc::thread::current |
( |
| ) |
|
|
static |
Returns the current thread. Note: Creates fc::thread object (but not a boost thread) if no current thread assigned yet (this can happend if current() is called from the main thread of application or from an existing "unknown" boost thread). In such cases, thread_d doesn't have access boost::thread object.
Definition at line 125 of file thread.cpp.
◆ current_priority()
priority fc::thread::current_priority |
( |
| ) |
const |
◆ current_task_desc()
const char * fc::thread::current_task_desc |
( |
| ) |
const |
◆ debug()
void fc::thread::debug |
( |
const std::string & |
d | ) |
|
print debug info about the state of every context / promise.
This method is helpful to figure out where your program is 'hung' by listing every async operation (context) and what it is blocked on (future).
- Note
- debug info is more useful if you provide a description for your async tasks and promises.
Definition at line 161 of file thread.cpp.
◆ is_current()
bool fc::thread::is_current |
( |
| ) |
const |
◆ is_running()
bool fc::thread::is_running |
( |
| ) |
const |
◆ name()
const string & fc::thread::name |
( |
| ) |
const |
◆ operator=()
◆ poke()
void fc::thread::poke |
( |
| ) |
|
◆ quit()
void fc::thread::quit |
( |
| ) |
|
This method will cancel all pending tasks causing them to throw cmt::error::thread_quit.
If the current thread is not this
thread, then the current thread will wait for this
thread to exit.
This is a blocking wait via boost::thread::join
and other tasks in the current thread will not run while waiting for this
thread to quit.
- Todo:
- make quit non-blocking of the calling thread by eliminating the call to
boost::thread::join
Definition at line 174 of file thread.cpp.
◆ schedule()
template<typename Functor >
Calls function f
in this thread and returns a future<T> that can be used to wait on the result.
- Parameters
-
f | the method to be called |
prio | the priority of this method relative to others |
when | determines when this call will happen, as soon as possible after when |
Definition at line 110 of file thread.hpp.
◆ set_name()
void fc::thread::set_name |
( |
const string & |
n | ) |
|
associates a name with this thread.
Definition at line 143 of file thread.cpp.
◆ signal()
void fc::thread::signal |
( |
int |
sig | ) |
|
Send signal to underlying native thread. Only for Linux and macOS
Definition at line 167 of file thread.cpp.
◆ wait_any()
template<typename T1 , typename T2 >
◆ detail::get_next_unused_task_storage_slot
◆ detail::get_task_specific_data
◆ detail::get_thread_specific_data
◆ detail::set_task_specific_data
◆ detail::set_thread_specific_data
◆ detail::worker_pool
◆ exec
void fc::thread::exec |
( |
| ) |
|
|
friend |
Enters the main loop processing tasks until quit() is called.
Definition at line 375 of file thread.cpp.
◆ mutex
◆ non_preemptable_scope_check
◆ promise_base
◆ sleep_until
void fc::thread::sleep_until |
( |
const time_point & |
tp | ) |
|
|
friend |
Yields until the specified time in the future.
Definition at line 371 of file thread.cpp.
◆ task_base
◆ thread_d
◆ usleep
Yields to other ready tasks for u microseconds.
Definition at line 368 of file thread.cpp.
◆ wait_any
◆ wait_any_until
◆ yield
Yields to other ready tasks before returning.
Definition at line 365 of file thread.cpp.
The documentation for this class was generated from the following files: