threading

The contents of this module can be included with the header hpx/modules/threading.hpp. These headers may be used by user-code but are not guaranteed stable (neither header location nor contents). You are using these at your own risk. If you wish to use non-public functionality from a module we strongly suggest only including the module header hpx/modules/threading.hpp, not the particular header in which the functionality you would like to use is defined. See Public API for a list of names that are part of the public HPX API.

Header hpx/thread.hpp

Header hpx/threading/jthread.hpp

namespace hpx

Functions

void swap(jthread &lhs, jthread &rhs)
class jthread
#include <jthread.hpp>

Public Types

using id = thread::id
using native_handle_type = thread::native_handle_type

Public Functions

jthread()
template<typename F, typename ...Ts, typename Enable = typename std::enable_if<!std::is_same<typename std::decay<F>::type, jthread>::value>::type>
jthread(F &&f, Ts&&... ts)
~jthread()
jthread(jthread const&)
jthread(jthread &&x)
jthread &operator=(jthread const&)
jthread &operator=(jthread&&)
void swap(jthread &t)
HPX_NODISCARD bool hpx::jthread::joinable() const
void join()
void detach()
HPX_NODISCARD id hpx::jthread::get_id() const
HPX_NODISCARD native_handle_type hpx::jthread::native_handle()
HPX_NODISCARD stop_source hpx::jthread::get_stop_source()
HPX_NODISCARD stop_token hpx::jthread::get_stop_token() const
bool request_stop()

Public Static Functions

static HPX_NODISCARD unsigned int hpx::jthread::hardware_concurrency()

Private Members

stop_source ssource_
hpx::thread thread_ = {}

Private Static Functions

template<typename F, typename ...Ts>
static void invoke(std::false_type, F &&f, stop_token &&st, Ts&&... ts)
template<typename F, typename ...Ts>
static void invoke(std::true_type, F &&f, stop_token &&st, Ts&&... ts)

Header hpx/threading/thread.hpp

namespace hpx

Typedefs

using thread_termination_handler_type = util::function_nonser<void(std::exception_ptr const &e)>

Functions

void set_thread_termination_handler(thread_termination_handler_type f)
void swap(thread &x, thread &y)
bool operator==(thread::id const &x, thread::id const &y)
bool operator!=(thread::id const &x, thread::id const &y)
bool operator<(thread::id const &x, thread::id const &y)
bool operator>(thread::id const &x, thread::id const &y)
bool operator<=(thread::id const &x, thread::id const &y)
bool operator>=(thread::id const &x, thread::id const &y)
template<typename Char, typename Traits>
std::basic_ostream<Char, Traits> &operator<<(std::basic_ostream<Char, Traits> &out, thread::id const &id)
class thread
#include <thread.hpp>

Public Types

typedef threads::thread_id_type native_handle_type

Public Functions

thread()
template<typename F, typename Enable = typename std::enable_if<!std::is_same<typename hpx::util::decay<F>::type, thread>::value>::type>
thread(F &&f)
template<typename F, typename ...Ts>
thread(F &&f, Ts&&... vs)
template<typename F>
thread(threads::thread_pool_base *pool, F &&f)
template<typename F, typename ...Ts>
thread(threads::thread_pool_base *pool, F &&f, Ts&&... vs)
~thread()
thread(thread&&)
thread &operator=(thread&&)
void swap(thread&)
bool joinable() const
void join()
void detach()
id get_id() const
native_handle_type native_handle() const
void interrupt(bool flag = true)
bool interruption_requested() const
lcos::future<void> get_future(error_code &ec = throws)
std::size_t get_thread_data() const
std::size_t set_thread_data(std::size_t)

Public Static Functions

static HPX_NODISCARD unsigned int hpx::thread::hardware_concurrency()
static void interrupt(id, bool flag = true)

Private Types

typedef lcos::local::spinlock mutex_type

Private Functions

void terminate(const char *function, const char *reason) const
bool joinable_locked() const
void detach_locked()
void start_thread(threads::thread_pool_base *pool, util::unique_function_nonser<void()> &&func)

Private Members

mutex_type mtx_
threads::thread_id_type id_

Private Static Functions

static threads::thread_result_type thread_function_nullary(util::unique_function_nonser<void()> const &func)
class id
#include <thread.hpp>

Public Functions

id()
id(threads::thread_id_type const &i)
id(threads::thread_id_type &&i)
threads::thread_id_type const &native_handle() const

Private Members

threads::thread_id_type id_

Friends

friend hpx::thread
bool operator==(thread::id const &x, thread::id const &y)
bool operator!=(thread::id const &x, thread::id const &y)
bool operator<(thread::id const &x, thread::id const &y)
bool operator>(thread::id const &x, thread::id const &y)
bool operator<=(thread::id const &x, thread::id const &y)
bool operator>=(thread::id const &x, thread::id const &y)
template<typename Char, typename Traits>
std::basic_ostream<Char, Traits> &operator<<(std::basic_ostream<Char, Traits> &out, thread::id const &id)
namespace this_thread

Functions

thread::id get_id()
void yield()
void yield_to(thread::id)
threads::thread_priority get_priority()
std::ptrdiff_t get_stack_size()
void interruption_point()
bool interruption_enabled()
bool interruption_requested()
void interrupt()
void sleep_until(util::steady_time_point const &abs_time)
void sleep_for(util::steady_duration const &rel_time)
std::size_t get_thread_data()
std::size_t set_thread_data(std::size_t)
class disable_interruption
#include <thread.hpp>

Public Functions

disable_interruption()
~disable_interruption()

Private Functions

disable_interruption(disable_interruption const&)
disable_interruption &operator=(disable_interruption const&)

Private Members

bool interruption_was_enabled_

Friends

friend hpx::this_thread::restore_interruption
class restore_interruption
#include <thread.hpp>

Public Functions

restore_interruption(disable_interruption &d)
~restore_interruption()

Private Functions

restore_interruption(restore_interruption const&)
restore_interruption &operator=(restore_interruption const&)

Private Members

bool interruption_was_enabled_