threading_base

The contents of this module can be included with the header hpx/modules/threading_base.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_base.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.

namespace hpx
namespace util

Functions

template<typename F>
constexpr F &&annotated_function(F &&f, char const* = nullptr)

Given a function as an argument, the user can annotate_function as well. Annotating includes setting the thread description per thread id.

Parameters
  • function:

template<typename F>
constexpr F &&annotated_function(F &&f, std::string const&)
struct annotate_function

Public Functions

HPX_NON_COPYABLE(annotate_function)
constexpr annotate_function(char const*)
template<typename F>
constexpr annotate_function(F&&)
~annotate_function()
namespace hpx
namespace threads
namespace policies
class callback_notifier

Public Types

typedef util::function_nonser<void(std::size_t, std::size_t, char const*, char const*)> on_startstop_type
typedef util::function_nonser<bool(std::size_t, std::exception_ptr const&)> on_error_type

Public Functions

callback_notifier()
void on_start_thread(std::size_t local_thread_num, std::size_t global_thread_num, char const *pool_name, char const *postfix) const
void on_stop_thread(std::size_t local_thread_num, std::size_t global_thread_num, char const *pool_name, char const *postfix) const
bool on_error(std::size_t global_thread_num, std::exception_ptr const &e) const
void add_on_start_thread_callback(on_startstop_type const &callback)
void add_on_stop_thread_callback(on_startstop_type const &callback)
void set_on_error_callback(on_error_type const &callback)

Public Members

std::deque<on_startstop_type> on_start_thread_callbacks_
std::deque<on_startstop_type> on_stop_thread_callbacks_
on_error_type on_error_
namespace hpx
namespace threads
struct execution_agent : public agent_base

Public Functions

execution_agent(coroutines::detail::coroutine_impl *coroutine)
std::string description() const
execution_context const &context() const
void yield(char const *desc)
void yield_k(std::size_t k, char const *desc)
void suspend(char const *desc)
void resume(char const *desc)
void abort(char const *desc)
void sleep_for(hpx::chrono::steady_duration const &sleep_duration, char const *desc)
void sleep_until(hpx::chrono::steady_time_point const &sleep_time, char const *desc)

Private Functions

hpx::threads::thread_restart_state do_yield(char const *desc, threads::thread_schedule_state state)
void do_resume(char const *desc, hpx::threads::thread_restart_state statex)

Private Members

coroutines::detail::coroutine_stackful_self self_
execution_context context_
struct execution_context : public context_base

Public Functions

hpx::execution_base::resource_base const &resource() const

Public Members

hpx::execution_base::resource_base resource_
namespace hpx
namespace util
namespace external_timer

Functions

std::shared_ptr<task_wrapper> new_task(thread_description const&, std::uint32_t, threads::thread_id_type const&)
std::shared_ptr<task_wrapper> update_task(std::shared_ptr<task_wrapper>, thread_description const&)
struct scoped_timer

Public Functions

scoped_timer(std::shared_ptr<task_wrapper>)
~scoped_timer()
void stop(void)
void yield(void)
namespace hpx
namespace threads

Functions

template<typename F>
thread_function_type make_thread_function(F &&f)
template<typename F>
thread_function_type make_thread_function_nullary(F &&f)
threads::thread_id_type register_thread(threads::thread_init_data &data, threads::thread_pool_base *pool, error_code &ec = throws)

Create a new thread using the given data.

Return

This function will return the internal id of the newly created HPX-thread.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • data: [in] The data to use for creating the thread.

  • pool: [in] The thread pool to use for launching the work.

  • ec: [in,out] This represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

Exceptions
  • invalid_status: if the runtime system has not been started yet.

threads::thread_id_type register_thread(threads::thread_init_data &data, error_code &ec = throws)

Create a new thread using the given data on the same thread pool as the calling thread, or on the default thread pool if not on an HPX thread.

Return

This function will return the internal id of the newly created HPX-thread.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • data: [in] The data to use for creating the thread.

  • ec: [in,out] This represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

Exceptions
  • invalid_status: if the runtime system has not been started yet.

void register_work(threads::thread_init_data &data, threads::thread_pool_base *pool, error_code &ec = throws)

Create a new work item using the given data.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • data: [in] The data to use for creating the thread.

  • pool: [in] The thread pool to use for launching the work.

  • ec: [in,out] This represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

Exceptions
  • invalid_status: if the runtime system has not been started yet.

void register_work(threads::thread_init_data &data, error_code &ec = throws)

Create a new work item using the given data on the same thread pool as the calling thread, or on the default thread pool if not on an HPX thread.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • data: [in] The data to use for creating the thread.

  • ec: [in,out] This represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

Exceptions
  • invalid_status: if the runtime system has not been started yet.

namespace hpx
namespace threads
namespace policies

Functions

std::ostream &operator<<(std::ostream &os, scheduler_base const &scheduler)
struct scheduler_base
#include <scheduler_base.hpp>

The scheduler_base defines the interface to be implemented by all scheduler policies

Public Types

typedef std::mutex pu_mutex_type
using polling_function_ptr = detail::polling_status (*)()
using polling_work_count_function_ptr = std::size_t (*)()

Public Functions

HPX_NON_COPYABLE(scheduler_base)
scheduler_base(std::size_t num_threads, char const *description = "", thread_queue_init_parameters thread_queue_init = {}, scheduler_mode mode = nothing_special)
virtual ~scheduler_base()
threads::thread_pool_base *get_parent_pool() const
void set_parent_pool(threads::thread_pool_base *p)
std::size_t global_to_local_thread_index(std::size_t n)
std::size_t local_to_global_thread_index(std::size_t n)
char const *get_description() const
void idle_callback(std::size_t num_thread)
void do_some_work(std::size_t)

This function gets called by the thread-manager whenever new work has been added, allowing the scheduler to reactivate one or more of possibly idling OS threads

virtual void suspend(std::size_t num_thread)
virtual void resume(std::size_t num_thread)
std::size_t select_active_pu(std::unique_lock<pu_mutex_type> &l, std::size_t num_thread, bool allow_fallback = false)
std::atomic<hpx::state> &get_state(std::size_t num_thread)
std::atomic<hpx::state> const &get_state(std::size_t num_thread) const
void set_all_states(hpx::state s)
void set_all_states_at_least(hpx::state s)
bool has_reached_state(hpx::state s) const
bool is_state(hpx::state s) const
std::pair<hpx::state, hpx::state> get_minmax_state() const
scheduler_mode get_scheduler_mode() const
bool has_scheduler_mode(scheduler_mode mode) const
virtual void set_scheduler_mode(scheduler_mode mode)
void add_scheduler_mode(scheduler_mode mode)
void remove_scheduler_mode(scheduler_mode mode)
void add_remove_scheduler_mode(scheduler_mode to_add_mode, scheduler_mode to_remove_mode)
void update_scheduler_mode(scheduler_mode mode, bool set)
pu_mutex_type &get_pu_mutex(std::size_t num_thread)
std::size_t domain_from_local_thread_index(std::size_t n)
std::size_t num_domains(const std::size_t workers)
std::vector<std::size_t> domain_threads(std::size_t local_id, const std::vector<std::size_t> &ts, util::function_nonser<bool(std::size_t, std::size_t)> pred)
virtual std::int64_t get_queue_length(std::size_t num_thread = std::size_t(-1)) const = 0
virtual std::int64_t get_thread_count(thread_schedule_state state = thread_schedule_state::unknown, thread_priority priority = thread_priority::default_, std::size_t num_thread = std::size_t(-1), bool reset = false) const = 0
virtual bool is_core_idle(std::size_t num_thread) const = 0
std::int64_t get_background_thread_count()
void increment_background_thread_count()
void decrement_background_thread_count()
virtual bool enumerate_threads(util::function_nonser<bool(thread_id_type)> const &f, thread_schedule_state state = thread_schedule_state::unknown, ) const = 0
virtual void abort_all_suspended_threads() = 0
virtual bool cleanup_terminated(bool delete_all) = 0
virtual bool cleanup_terminated(std::size_t num_thread, bool delete_all) = 0
virtual void create_thread(thread_init_data &data, thread_id_type *id, error_code &ec) = 0
virtual bool get_next_thread(std::size_t num_thread, bool running, threads::thread_data *&thrd, bool enable_stealing) = 0
virtual void schedule_thread(threads::thread_data *thrd, threads::thread_schedule_hint schedulehint, bool allow_fallback = false, thread_priority priority = thread_priority::normal) = 0
virtual void schedule_thread_last(threads::thread_data *thrd, threads::thread_schedule_hint schedulehint, bool allow_fallback = false, thread_priority priority = thread_priority::normal) = 0
virtual void destroy_thread(threads::thread_data *thrd) = 0
virtual bool wait_or_add_new(std::size_t num_thread, bool running, std::int64_t &idle_loop_count, bool enable_stealing, std::size_t &added) = 0
virtual void on_start_thread(std::size_t num_thread) = 0
virtual void on_stop_thread(std::size_t num_thread) = 0
virtual void on_error(std::size_t num_thread, std::exception_ptr const &e) = 0
virtual void reset_thread_distribution()
std::ptrdiff_t get_stack_size(threads::thread_stacksize stacksize) const
void set_mpi_polling_functions(polling_function_ptr mpi_func, polling_work_count_function_ptr mpi_work_count_func)
void clear_mpi_polling_function()
void set_cuda_polling_functions(polling_function_ptr cuda_func, polling_work_count_function_ptr cuda_work_count_func)
void clear_cuda_polling_function()
detail::polling_status custom_polling_function() const
std::size_t get_polling_work_count() const

Public Static Functions

static detail::polling_status null_polling_function()
static std::size_t null_polling_work_count_function()

Protected Attributes

util::cache_line_data<std::atomic<scheduler_mode>> mode_
std::vector<pu_mutex_type> suspend_mtxs_
std::vector<std::condition_variable> suspend_conds_
std::vector<pu_mutex_type> pu_mtxs_
std::vector<std::atomic<hpx::state>> states_
char const *description_
thread_queue_init_parameters thread_queue_init_
threads::thread_pool_base *parent_pool_
std::atomic<std::int64_t> background_thread_count_
std::atomic<polling_function_ptr> polling_function_mpi_
std::atomic<polling_function_ptr> polling_function_cuda_
std::atomic<polling_work_count_function_ptr> polling_work_count_function_mpi_
std::atomic<polling_work_count_function_ptr> polling_work_count_function_cuda_
namespace hpx
namespace threads
namespace policies

Enums

enum scheduler_mode

This enumeration describes the possible modes of a scheduler.

Values:

nothing_special = 0x000

As the name suggests, this option can be used to disable all other options.

do_background_work = 0x001

The scheduler will periodically call a provided callback function from a special HPX thread to enable performing background-work, for instance driving networking progress or garbage-collect AGAS.

reduce_thread_priority = 0x002

The kernel priority of the os-thread driving the scheduler will be reduced below normal.

delay_exit = 0x004

The scheduler will wait for some unspecified amount of time before exiting the scheduling loop while being terminated to make sure no other work is being scheduled during processing the shutdown request.

fast_idle_mode = 0x008

Some schedulers have the capability to act as ‘embedded’ schedulers. In this case it needs to periodically invoke a provided callback into the outer scheduler more frequently than normal. This option enables this behavior.

enable_elasticity = 0x010

This option allows for the scheduler to dynamically increase and reduce the number of processing units it runs on. Setting this value not succeed for schedulers that do not support this functionality.

enable_stealing = 0x020

This option allows schedulers that support work thread/stealing to enable/disable it

enable_stealing_numa = 0x040

This option allows schedulersthat support it to disallow stealing between numa domains

assign_work_round_robin = 0x080

This option tells schedulersthat support it to add tasks round robin to queues on each core

assign_work_thread_parent = 0x100

This option tells schedulers that support it to add tasks round to the same core/queue that the parent task is running on

steal_high_priority_first = 0x200

This option tells schedulers that support it to always (try to) steal high priority tasks from other queues before finishing their own lower priority tasks

steal_after_local = 0x400

This option tells schedulers that support it to steal tasks only when their local queues are empty

enable_idle_backoff = 0x0800

This option allows for certain schedulers to explicitly disable exponential idle-back off

default_mode = do_background_work | reduce_thread_priority | delay_exit | enable_stealing | enable_stealing_numa | assign_work_round_robin | steal_after_local | enable_idle_backoff

This option represents the default mode.

all_flags = do_background_work | reduce_thread_priority | delay_exit | fast_idle_mode | enable_elasticity | enable_stealing | enable_stealing_numa | assign_work_round_robin | assign_work_thread_parent | steal_high_priority_first | steal_after_local | enable_idle_backoff

This enables all available options.

namespace hpx

Enums

enum state

Values:

state_invalid = -1
state_initialized = 0
first_valid_runtime_state = state_initialized
state_pre_startup = 1
state_startup = 2
state_pre_main = 3
state_starting = 4
state_running = 5
state_suspended = 6
state_pre_sleep = 7
state_sleeping = 8
state_pre_shutdown = 9
state_shutdown = 10
state_stopping = 11
state_terminating = 12
state_stopped = 13
last_valid_runtime_state = state_stopped
namespace hpx
namespace threads

Functions

constexpr thread_data *get_thread_id_data(thread_id_type const &tid)
thread_self &get_self()

The function get_self returns a reference to the (OS thread specific) self reference to the current HPX thread.

thread_self *get_self_ptr()

The function get_self_ptr returns a pointer to the (OS thread specific) self reference to the current HPX thread.

thread_self_impl_type *get_ctx_ptr()

The function get_ctx_ptr returns a pointer to the internal data associated with each coroutine.

thread_self *get_self_ptr_checked(error_code &ec = throws)

The function get_self_ptr_checked returns a pointer to the (OS thread specific) self reference to the current HPX thread.

thread_id_type get_self_id()

The function get_self_id returns the HPX thread id of the current thread (or zero if the current thread is not a HPX thread).

thread_data *get_self_id_data()

The function get_self_id_data returns the data of the HPX thread id associated with the current thread (or nullptr if the current thread is not a HPX thread).

thread_id_type get_parent_id()

The function get_parent_id returns the HPX thread id of the current thread’s parent (or zero if the current thread is not a HPX thread).

Note

This function will return a meaningful value only if the code was compiled with HPX_HAVE_THREAD_PARENT_REFERENCE being defined.

std::size_t get_parent_phase()

The function get_parent_phase returns the HPX phase of the current thread’s parent (or zero if the current thread is not a HPX thread).

Note

This function will return a meaningful value only if the code was compiled with HPX_HAVE_THREAD_PARENT_REFERENCE being defined.

std::ptrdiff_t get_self_stacksize()

The function get_self_stacksize returns the stack size of the current thread (or zero if the current thread is not a HPX thread).

thread_stacksize get_self_stacksize_enum()

The function get_self_stacksize_enum returns the stack size of the /.

std::uint32_t get_parent_locality_id()

The function get_parent_locality_id returns the id of the locality of the current thread’s parent (or zero if the current thread is not a HPX thread).

Note

This function will return a meaningful value only if the code was compiled with HPX_HAVE_THREAD_PARENT_REFERENCE being defined.

std::uint64_t get_self_component_id()

The function get_self_component_id returns the lva of the component the current thread is acting on

Note

This function will return a meaningful value only if the code was compiled with HPX_HAVE_THREAD_TARGET_ADDRESS being defined.

class thread_data
#include <thread_data.hpp>

A thread is the representation of a ParalleX thread. It’s a first class object in ParalleX. In our implementation this is a user level thread running on top of one of the OS threads spawned by the thread-manager.

A thread encapsulates:

  • A thread status word (see the functions thread::get_state and thread::set_state)

  • A function to execute (the thread function)

  • A frame (in this implementation this is a block of memory used as the threads stack)

  • A block of registers (not implemented yet)

Generally, threads are not created or executed directly. All functionality related to the management of threads is implemented by the thread-manager.

Subclassed by hpx::threads::thread_data_stackful, hpx::threads::thread_data_stackless

Public Types

using spinlock_pool = util::spinlock_pool<thread_data>

Public Functions

thread_data(thread_data const&)
thread_data(thread_data&&)
thread_data &operator=(thread_data const&)
thread_data &operator=(thread_data&&)
thread_state get_state(std::memory_order order = std::memory_order_acquire) const

The get_state function queries the state of this thread instance.

Return

This function returns the current state of this thread. It will return one of the values as defined by the thread_state enumeration.

Note

This function will be seldom used directly. Most of the time the state of a thread will be retrieved by using the function threadmanager::get_state.

thread_state set_state(thread_schedule_state state, thread_restart_state state_ex = thread_restart_state::unknown, std::memory_order load_order = std::memory_order_acquire, std::memory_order exchange_order = std::memory_order_seq_cst)

The set_state function changes the state of this thread instance.

Note

This function will be seldom used directly. Most of the time the state of a thread will have to be changed using the threadmanager. Moreover, changing the thread state using this function does not change its scheduling status. It only sets the thread’s status word. To change the thread’s scheduling status threadmanager::set_state should be used.

Parameters
  • newstate: [in] The new state to be set for the thread.

bool set_state_tagged(thread_schedule_state newstate, thread_state &prev_state, thread_state &new_tagged_state, std::memory_order exchange_order = std::memory_order_seq_cst)
bool restore_state(thread_state new_state, thread_state old_state, std::memory_order load_order = std::memory_order_relaxed, std::memory_order load_exchange = std::memory_order_seq_cst)

The restore_state function changes the state of this thread instance depending on its current state. It will change the state atomically only if the current state is still the same as passed as the second parameter. Otherwise it won’t touch the thread state of this instance.

Note

This function will be seldom used directly. Most of the time the state of a thread will have to be changed using the threadmanager. Moreover, changing the thread state using this function does not change its scheduling status. It only sets the thread’s status word. To change the thread’s scheduling status threadmanager::set_state should be used.

Return

This function returns true if the state has been changed successfully

Parameters
  • newstate: [in] The new state to be set for the thread.

  • oldstate: [in] The old state of the thread which still has to be the current state.

bool restore_state(thread_schedule_state new_state, thread_restart_state state_ex, thread_state old_state, std::memory_order load_exchange = std::memory_order_seq_cst)
constexpr std::uint64_t get_component_id() const

Return the id of the component this thread is running in.

util::thread_description get_description() const
util::thread_description set_description(util::thread_description)
util::thread_description get_lco_description() const
util::thread_description set_lco_description(util::thread_description)
constexpr std::uint32_t get_parent_locality_id() const

Return the locality of the parent thread.

constexpr thread_id_type get_parent_thread_id() const

Return the thread id of the parent thread.

constexpr std::size_t get_parent_thread_phase() const

Return the phase of the parent thread.

constexpr util::backtrace const *get_backtrace() const
util::backtrace const *set_backtrace(util::backtrace const*)
constexpr thread_priority get_priority() const
void set_priority(thread_priority priority)
bool interruption_requested() const
bool interruption_enabled() const
bool set_interruption_enabled(bool enable)
void interrupt(bool flag = true)
bool interruption_point(bool throw_on_interrupt = true)
bool add_thread_exit_callback(util::function_nonser<void()> const &f)
void run_thread_exit_callbacks()
void free_thread_exit_callbacks()
policies::scheduler_base *get_scheduler_base() const
std::size_t get_last_worker_thread_num() const
void set_last_worker_thread_num(std::size_t last_worker_thread_num)
std::ptrdiff_t get_stack_size() const
thread_stacksize get_stack_size_enum() const
template<typename ThreadQueue>
ThreadQueue &get_queue()
coroutine_type::result_type operator()(hpx::execution_base::this_thread::detail::agent_storage *agent_storage)

Execute the thread function.

Return

This function returns the thread state the thread should be scheduled from this point on. The thread manager will use the returned value to set the thread’s scheduling status.

virtual thread_id_type get_thread_id() const
virtual std::size_t get_thread_phase() const
virtual std::size_t get_thread_data() const = 0
virtual std::size_t set_thread_data(std::size_t data) = 0
virtual void rebind(thread_init_data &init_data) = 0
thread_data(thread_init_data &init_data, void *queue, std::ptrdiff_t stacksize, bool is_stackless = false)
virtual ~thread_data()
virtual void destroy() = 0

Public Members

bool is_stackless_

Protected Functions

thread_restart_state set_state_ex(thread_restart_state new_state)

The set_state function changes the extended state of this thread instance.

Note

This function will be seldom used directly. Most of the time the state of a thread will have to be changed using the threadmanager.

Parameters
  • newstate: [in] The new extended state to be set for the thread.

void rebind_base(thread_init_data &init_data)

Private Members

std::atomic<thread_state> current_state_
thread_priority priority_
bool requested_interrupt_
bool enabled_interrupt_
bool ran_exit_funcs_
std::forward_list<util::function_nonser<void()>> exit_funcs_
policies::scheduler_base *scheduler_base_
std::size_t last_worker_thread_num_
std::ptrdiff_t stacksize_
thread_stacksize stacksize_enum_
void *queue_
namespace hpx
namespace threads
class thread_data_stackful : public hpx::threads::thread_data
#include <thread_data_stackful.hpp>

A thread is the representation of a ParalleX thread. It’s a first class object in ParalleX. In our implementation this is a user level thread running on top of one of the OS threads spawned by the thread-manager.

A thread encapsulates:

  • A thread status word (see the functions thread::get_state and thread::set_state)

  • A function to execute (the thread function)

  • A frame (in this implementation this is a block of memory used as the threads stack)

  • A block of registers (not implemented yet)

Generally, threads are not created or executed directly. All functionality related to the management of threads is implemented by the thread-manager.

Public Functions

coroutine_type::result_type call(hpx::execution_base::this_thread::detail::agent_storage *agent_storage)
std::size_t get_thread_data() const
std::size_t set_thread_data(std::size_t data)
void rebind(thread_init_data &init_data)
thread_data_stackful(thread_init_data &init_data, void *queue, std::ptrdiff_t stacksize)
~thread_data_stackful()
void destroy()

Public Static Functions

thread_data *create(thread_init_data &init_data, void *queue, std::ptrdiff_t stacksize)

Private Functions

thread_data *this_()

Private Members

coroutine_type coroutine_
execution_agent agent_

Private Static Attributes

util::internal_allocator<thread_data_stackful> thread_alloc_
namespace hpx
namespace threads
class thread_data_stackless : public hpx::threads::thread_data
#include <thread_data_stackless.hpp>

A thread is the representation of a ParalleX thread. It’s a first class object in ParalleX. In our implementation this is a user level thread running on top of one of the OS threads spawned by the thread-manager.

A thread encapsulates:

  • A thread status word (see the functions thread::get_state and thread::set_state)

  • A function to execute (the thread function)

  • A frame (in this implementation this is a block of memory used as the threads stack)

  • A block of registers (not implemented yet)

Generally, threads are not created or executed directly. All functionality related to the management of threads is implemented by the thread-manager.

Public Functions

stackless_coroutine_type::result_type call()
std::size_t get_thread_data() const
std::size_t set_thread_data(std::size_t data)
void rebind(thread_init_data &init_data)
thread_data_stackless(thread_init_data &init_data, void *queue, std::ptrdiff_t stacksize)
~thread_data_stackless()
void destroy()

Public Static Functions

thread_data *create(thread_init_data &init_data, void *queue, std::ptrdiff_t stacksize)

Private Functions

thread_data *this_()

Private Members

stackless_coroutine_type coroutine_

Private Static Attributes

util::internal_allocator<thread_data_stackless> thread_alloc_
namespace hpx
namespace threads

Functions

util::thread_description get_thread_description(thread_id_type const &id, error_code &ec = throws)

The function get_thread_description is part of the thread related API allows to query the description of one of the threads known to the thread-manager.

Return

This function returns the description of the thread referenced by the id parameter. If the thread is not known to the thread-manager the return value will be the string “<unknown>”.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread being queried.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

util::thread_description set_thread_description(thread_id_type const &id, util::thread_description const &desc = util::thread_description(), error_code &ec = throws)
util::thread_description get_thread_lco_description(thread_id_type const &id, error_code &ec = throws)
util::thread_description set_thread_lco_description(thread_id_type const &id, util::thread_description const &desc = util::thread_description(), error_code &ec = throws)
namespace util

Functions

std::ostream &operator<<(std::ostream&, thread_description const&)
std::string as_string(thread_description const &desc)
struct thread_description

Public Types

enum data_type

Values:

data_type_description = 0
data_type_address = 1

Public Functions

thread_description()
constexpr thread_description(char const*)
template<typename F, typename = typename std::enable_if<!std::is_same<F, thread_description>::value && !traits::is_action<F>::value>::type>
constexpr thread_description(F const&, char const* = nullptr)
template<typename Action, typename = typename std::enable_if<traits::is_action<Action>::value>::type>
constexpr thread_description(Action, char const* = nullptr)
constexpr data_type kind() const
constexpr char const *get_description() const
constexpr std::size_t get_address() const
constexpr operator bool() const
constexpr bool valid() const

Private Functions

void init_from_alternative_name(char const *altname)
namespace hpx
namespace this_thread

Functions

threads::thread_restart_state suspend(threads::thread_schedule_state state, threads::thread_id_type const &id, util::thread_description const &description = util::thread_description("this_thread::suspend"), error_code &ec = throws)

The function suspend will return control to the thread manager (suspends the current thread). It sets the new state of this thread to the thread state passed as the parameter.

Note

Must be called from within a HPX-thread.

Exceptions
  • If: &ec != &throws, never throws, but will set ec to an appropriate value when an error occurs. Otherwise, this function will throw an hpx::exception with an error code of hpx::yield_aborted if it is signaled with wait_aborted. If called outside of a HPX-thread, this function will throw an hpx::exception with an error code of hpx::null_thread_id. If this function is called while the thread-manager is not running, it will throw an hpx::exception with an error code of hpx::invalid_status.

threads::thread_restart_state suspend(threads::thread_schedule_state state = threads::thread_schedule_state::pending, util::thread_description const &description = util::thread_description("this_thread::suspend"), error_code &ec = throws)

The function suspend will return control to the thread manager (suspends the current thread). It sets the new state of this thread to the thread state passed as the parameter.

Note

Must be called from within a HPX-thread.

Exceptions
  • If: &ec != &throws, never throws, but will set ec to an appropriate value when an error occurs. Otherwise, this function will throw an hpx::exception with an error code of hpx::yield_aborted if it is signaled with wait_aborted. If called outside of a HPX-thread, this function will throw an hpx::exception with an error code of hpx::null_thread_id. If this function is called while the thread-manager is not running, it will throw an hpx::exception with an error code of hpx::invalid_status.

threads::thread_restart_state suspend(hpx::chrono::steady_time_point const &abs_time, threads::thread_id_type const &id, util::thread_description const &description = util::thread_description("this_thread::suspend"), error_code &ec = throws)

The function suspend will return control to the thread manager (suspends the current thread). It sets the new state of this thread to suspended and schedules a wakeup for this threads at the given time.

Note

Must be called from within a HPX-thread.

Exceptions
  • If: &ec != &throws, never throws, but will set ec to an appropriate value when an error occurs. Otherwise, this function will throw an hpx::exception with an error code of hpx::yield_aborted if it is signaled with wait_aborted. If called outside of a HPX-thread, this function will throw an hpx::exception with an error code of hpx::null_thread_id. If this function is called while the thread-manager is not running, it will throw an hpx::exception with an error code of hpx::invalid_status.

threads::thread_restart_state suspend(hpx::chrono::steady_time_point const &abs_time, util::thread_description const &description = util::thread_description("this_thread::suspend"), error_code &ec = throws)

The function suspend will return control to the thread manager (suspends the current thread). It sets the new state of this thread to suspended and schedules a wakeup for this threads at the given time.

Note

Must be called from within a HPX-thread.

Exceptions
  • If: &ec != &throws, never throws, but will set ec to an appropriate value when an error occurs. Otherwise, this function will throw an hpx::exception with an error code of hpx::yield_aborted if it is signaled with wait_aborted. If called outside of a HPX-thread, this function will throw an hpx::exception with an error code of hpx::null_thread_id. If this function is called while the thread-manager is not running, it will throw an hpx::exception with an error code of hpx::invalid_status.

threads::thread_restart_state suspend(hpx::chrono::steady_duration const &rel_time, util::thread_description const &description = util::thread_description("this_thread::suspend"), error_code &ec = throws)

The function suspend will return control to the thread manager (suspends the current thread). It sets the new state of this thread to suspended and schedules a wakeup for this threads after the given duration.

Note

Must be called from within a HPX-thread.

Exceptions
  • If: &ec != &throws, never throws, but will set ec to an appropriate value when an error occurs. Otherwise, this function will throw an hpx::exception with an error code of hpx::yield_aborted if it is signaled with wait_aborted. If called outside of a HPX-thread, this function will throw an hpx::exception with an error code of hpx::null_thread_id. If this function is called while the thread-manager is not running, it will throw an hpx::exception with an error code of hpx::invalid_status.

threads::thread_restart_state suspend(hpx::chrono::steady_duration const &rel_time, threads::thread_id_type const &id, util::thread_description const &description = util::thread_description("this_thread::suspend"), error_code &ec = throws)

The function suspend will return control to the thread manager (suspends the current thread). It sets the new state of this thread to suspended and schedules a wakeup for this threads after the given duration.

Note

Must be called from within a HPX-thread.

Exceptions
  • If: &ec != &throws, never throws, but will set ec to an appropriate value when an error occurs. Otherwise, this function will throw an hpx::exception with an error code of hpx::yield_aborted if it is signaled with wait_aborted. If called outside of a HPX-thread, this function will throw an hpx::exception with an error code of hpx::null_thread_id. If this function is called while the thread-manager is not running, it will throw an hpx::exception with an error code of hpx::invalid_status.

threads::thread_restart_state suspend(std::uint64_t ms, util::thread_description const &description = util::thread_description("this_thread::suspend"), error_code &ec = throws)

The function suspend will return control to the thread manager (suspends the current thread). It sets the new state of this thread to suspended and schedules a wakeup for this threads after the given time (specified in milliseconds).

Note

Must be called from within a HPX-thread.

Exceptions
  • If: &ec != &throws, never throws, but will set ec to an appropriate value when an error occurs. Otherwise, this function will throw an hpx::exception with an error code of hpx::yield_aborted if it is signaled with wait_aborted. If called outside of a HPX-thread, this function will throw an hpx::exception with an error code of hpx::null_thread_id. If this function is called while the thread-manager is not running, it will throw an hpx::exception with an error code of hpx::invalid_status.

threads::thread_pool_base *get_pool(error_code &ec = throws)

Returns a pointer to the pool that was used to run the current thread

Exceptions
  • If: &ec != &throws, never throws, but will set ec to an appropriate value when an error occurs. Otherwise, this function will throw an hpx::exception with an error code of hpx::yield_aborted if it is signaled with wait_aborted. If called outside of a HPX-thread, this function will throw an hpx::exception with an error code of hpx::null_thread_id. If this function is called while the thread-manager is not running, it will throw an hpx::exception with an error code of hpx::invalid_status.

namespace threads

Functions

thread_state set_thread_state(thread_id_type const &id, thread_schedule_state state = thread_schedule_state::pending, thread_restart_state stateex = thread_restart_state::signaled, thread_priority priority = thread_priority::normal, bool retry_on_active = true, hpx::error_code &ec = throws)

Set the thread state of the thread referenced by the thread_id id.

Note

If the thread referenced by the parameter id is in thread_state::active state this function schedules a new thread which will set the state of the thread as soon as its not active anymore. The function returns thread_state::active in this case.

Return

This function returns the previous state of the thread referenced by the id parameter. It will return one of the values as defined by the thread_state enumeration. If the thread is not known to the thread-manager the return value will be thread_state::unknown.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread the state should be modified for.

  • state: [in] The new state to be set for the thread referenced by the id parameter.

  • stateex: [in] The new extended state to be set for the thread referenced by the id parameter.

  • priority:

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

thread_id_type set_thread_state(thread_id_type const &id, hpx::chrono::steady_time_point const &abs_time, std::atomic<bool> *started, thread_schedule_state state = thread_schedule_state::pending, thread_restart_state stateex = thread_restart_state::timeout, thread_priority priority = thread_priority::normal, bool retry_on_active = true, error_code &ec = throws)

Set the thread state of the thread referenced by the thread_id id.

Set a timer to set the state of the given thread to the given new value after it expired (at the given time)

Return

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread the state should be modified for.

  • abs_time: [in] Absolute point in time for the new thread to be run

  • started: [in,out] A helper variable allowing to track the state of the timer helper thread

  • state: [in] The new state to be set for the thread referenced by the id parameter.

  • stateex: [in] The new extended state to be set for the thread referenced by the id parameter.

  • priority:

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

thread_id_type set_thread_state(thread_id_type const &id, hpx::chrono::steady_time_point const &abs_time, thread_schedule_state state = thread_schedule_state::pending, thread_restart_state stateex = thread_restart_state::timeout, thread_priority priority = thread_priority::normal, bool retry_on_active = true, error_code& = throws)
thread_id_type set_thread_state(thread_id_type const &id, hpx::chrono::steady_duration const &rel_time, thread_schedule_state state = thread_schedule_state::pending, thread_restart_state stateex = thread_restart_state::timeout, thread_priority priority = thread_priority::normal, bool retry_on_active = true, error_code &ec = throws)

Set the thread state of the thread referenced by the thread_id id.

Set a timer to set the state of the given thread to the given new value after it expired (after the given duration)

Return

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread the state should be modified for.

  • rel_time: [in] Time duration after which the new thread should be run

  • state: [in] The new state to be set for the thread referenced by the id parameter.

  • stateex: [in] The new extended state to be set for the thread referenced by the id parameter.

  • priority:

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

thread_state get_thread_state(thread_id_type const &id, error_code &ec = throws)

The function get_thread_backtrace is part of the thread related API allows to query the currently stored thread back trace (which is captured during thread suspension).

Return

This function returns the currently captured stack back trace of the thread referenced by the id parameter. If the thread is not known to the thread-manager the return value will be the zero.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception. The function get_thread_state is part of the thread related API. It queries the state of one of the threads known to the thread-manager.

Return

This function returns the thread state of the thread referenced by the id parameter. If the thread is not known to the thread-manager the return value will be terminated.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread being queried.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

Parameters
  • id: [in] The thread id of the thread the state should be modified for.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

std::size_t get_thread_phase(thread_id_type const &id, error_code &ec = throws)

The function get_thread_phase is part of the thread related API. It queries the phase of one of the threads known to the thread-manager.

Return

This function returns the thread phase of the thread referenced by the id parameter. If the thread is not known to the thread-manager the return value will be ~0.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread the phase should be modified for.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

bool get_thread_interruption_enabled(thread_id_type const &id, error_code &ec = throws)

Returns whether the given thread can be interrupted at this point.

Return

This function returns true if the given thread can be interrupted at this point in time. It will return false otherwise.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread which should be queried.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

bool set_thread_interruption_enabled(thread_id_type const &id, bool enable, error_code &ec = throws)

Set whether the given thread can be interrupted at this point.

Return

This function returns the previous value of whether the given thread could have been interrupted.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread which should receive the new value.

  • enable: [in] This value will determine the new interruption enabled status for the given thread.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

bool get_thread_interruption_requested(thread_id_type const &id, error_code &ec = throws)

Returns whether the given thread has been flagged for interruption.

Return

This function returns true if the given thread was flagged for interruption. It will return false otherwise.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread which should be queried.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

void interrupt_thread(thread_id_type const &id, bool flag, error_code &ec = throws)

Flag the given thread for interruption.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread which should be interrupted.

  • flag: [in] The flag encodes whether the thread should be interrupted (if it is true), or ‘uninterrupted’ (if it is false).

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

void interrupt_thread(thread_id_type const &id, error_code &ec = throws)
void interruption_point(thread_id_type const &id, error_code &ec = throws)

Interrupt the current thread at this point if it was canceled. This will throw a thread_interrupted exception, which will cancel the thread.

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread which should be interrupted.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

threads::thread_priority get_thread_priority(thread_id_type const &id, error_code &ec = throws)

Return priority of the given thread

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread whose priority is queried.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

std::ptrdiff_t get_stack_size(thread_id_type const &id, error_code &ec = throws)

Return stack size of the given thread

Note

As long as ec is not pre-initialized to hpx::throws this function doesn’t throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

Parameters
  • id: [in] The thread id of the thread whose priority is queried.

  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

threads::thread_pool_base *get_pool(thread_id_type const &id, error_code &ec = throws)

Returns a pointer to the pool that was used to run the current thread

Exceptions
  • If: &ec != &throws, never throws, but will set ec to an appropriate value when an error occurs. Otherwise, this function will throw an hpx::exception with an error code of hpx::yield_aborted if it is signaled with wait_aborted. If called outside of a HPX-thread, this function will throw an hpx::exception with an error code of hpx::null_thread_id. If this function is called while the thread-manager is not running, it will throw an hpx::exception with an error code of hpx::invalid_status.

namespace hpx
namespace threads
class thread_init_data

Public Functions

thread_init_data()
thread_init_data &operator=(thread_init_data &&rhs)
thread_init_data(thread_init_data &&rhs)
template<typename F>
thread_init_data(F &&f, util::thread_description const &desc, thread_priority priority_ = thread_priority::normal, thread_schedule_hint os_thread = thread_schedule_hint(), thread_stacksize stacksize_ = thread_stacksize::default_, thread_schedule_state initial_state_ = thread_schedule_state::pending, bool run_now_ = false, policies::scheduler_base *scheduler_base_ = nullptr)

Public Members

threads::thread_function_type func
thread_priority priority
thread_schedule_hint schedulehint
thread_stacksize stacksize
thread_schedule_state initial_state
bool run_now
policies::scheduler_base *scheduler_base
namespace hpx

Functions

std::size_t get_worker_thread_num()

Return the number of the current OS-thread running in the runtime instance the current HPX-thread is executed with.

This function returns the zero based index of the OS-thread which executes the current HPX-thread.

Note

The returned value is zero based and its maximum value is smaller than the overall number of OS-threads executed (as returned by get_os_thread_count().

Note

This function needs to be executed on a HPX-thread. It will fail otherwise (it will return -1).

std::size_t get_worker_thread_num(error_code &ec)

Return the number of the current OS-thread running in the runtime instance the current HPX-thread is executed with.

This function returns the zero based index of the OS-thread which executes the current HPX-thread.

Note

The returned value is zero based and its maximum value is smaller than the overall number of OS-threads executed (as returned by get_os_thread_count(). It will return -1 if the current thread is not a known thread or if the runtime is not in running state.

Note

This function needs to be executed on a HPX-thread. It will fail otherwise (it will return -1).

Parameters
  • ec: [in,out] this represents the error status on exit.

std::size_t get_local_worker_thread_num()

Return the number of the current OS-thread running in the current thread pool the current HPX-thread is executed with.

This function returns the zero based index of the OS-thread on the current thread pool which executes the current HPX-thread.

Note

The returned value is zero based and its maximum value is smaller than the number of OS-threads executed on the current thread pool. It will return -1 if the current thread is not a known thread or if the runtime is not in running state.

Note

This function needs to be executed on a HPX-thread. It will fail otherwise (it will return -1).

std::size_t get_local_worker_thread_num(error_code &ec)

Return the number of the current OS-thread running in the current thread pool the current HPX-thread is executed with.

This function returns the zero based index of the OS-thread on the current thread pool which executes the current HPX-thread.

Note

The returned value is zero based and its maximum value is smaller than the number of OS-threads executed on the current thread pool. It will return -1 if the current thread is not a known thread or if the runtime is not in running state.

Note

This function needs to be executed on a HPX-thread. It will fail otherwise (it will return -1).

Parameters
  • ec: [in,out] this represents the error status on exit.

std::size_t get_thread_pool_num()

Return the number of the current thread pool the current HPX-thread is executed with.

This function returns the zero based index of the thread pool which executes the current HPX-thread.

Note

The returned value is zero based and its maximum value is smaller than the number of thread pools started by the runtime. It will return -1 if the current thread pool is not a known thread pool or if the runtime is not in running state.

Note

This function needs to be executed on a HPX-thread. It will fail otherwise (it will return -1).

std::size_t get_thread_pool_num(error_code &ec)

Return the number of the current thread pool the current HPX-thread is executed with.

This function returns the zero based index of the thread pool which executes the current HPX-thread.

Note

The returned value is zero based and its maximum value is smaller than the number of thread pools started by the runtime. It will return -1 if the current thread pool is not a known thread pool or if the runtime is not in running state.

Note

This function needs to be executed on a HPX-thread. It will fail otherwise (it will return -1).

Parameters
  • ec: [in,out] this represents the error status on exit.

namespace hpx
namespace threads

Functions

std::ostream &operator<<(std::ostream &os, thread_pool_base const &thread_pool)
struct executor_statistics
#include <thread_pool_base.hpp>

Data structure which stores statistics collected by an executor instance.

Public Functions

executor_statistics()

Public Members

std::uint64_t tasks_scheduled_
std::uint64_t tasks_completed_
std::uint64_t queue_length_
class thread_pool_base
#include <thread_pool_base.hpp>

The base class used to manage a pool of OS threads.

Public Functions

virtual void suspend_processing_unit_direct(std::size_t virt_core, error_code &ec = throws) = 0

Suspends the given processing unit. Blocks until the processing unit has been suspended.

Parameters
  • virt_core: [in] The processing unit on the the pool to be suspended. The processing units are indexed starting from 0.

virtual void resume_processing_unit_direct(std::size_t virt_core, error_code &ec = throws) = 0

Resumes the given processing unit. Blocks until the processing unit has been resumed.

Parameters
  • virt_core: [in] The processing unit on the the pool to be resumed. The processing units are indexed starting from 0.

virtual void resume_direct(error_code &ec = throws) = 0

Resumes the thread pool. Blocks until all OS threads on the thread pool have been resumed.

Parameters
  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

virtual void suspend_direct(error_code &ec = throws) = 0

Suspends the thread pool. Blocks until all OS threads on the thread pool have been suspended.

Note

A thread pool cannot be suspended from an HPX thread running on the pool itself.

Parameters
  • ec: [in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

Exceptions
  • hpx::exception: if called from an HPX thread which is running on the pool itself.

struct thread_pool_init_parameters

Public Functions

thread_pool_init_parameters(std::string const &name, std::size_t index, policies::scheduler_mode mode, std::size_t num_threads, std::size_t thread_offset, hpx::threads::policies::callback_notifier &notifier, hpx::threads::policies::detail::affinity_data const &affinity_data, hpx::threads::detail::network_background_callback_type const &network_background_callback = hpx::threads::detail::network_background_callback_type(), std::size_t max_background_threads = std::size_t(-1), std::size_t max_idle_loop_count = HPX_IDLE_LOOP_COUNT_MAX, std::size_t max_busy_loop_count = HPX_BUSY_LOOP_COUNT_MAX, std::size_t shutdown_check_count = 10)

Public Members

std::string const &name_
std::size_t index_
policies::scheduler_mode mode_
std::size_t num_threads_
std::size_t thread_offset_
hpx::threads::policies::callback_notifier &notifier_
hpx::threads::policies::detail::affinity_data const &affinity_data_
hpx::threads::detail::network_background_callback_type const &network_background_callback_
std::size_t max_background_threads_
std::size_t max_idle_loop_count_
std::size_t max_busy_loop_count_
std::size_t shutdown_check_count_
namespace hpx
namespace threads
namespace policies
struct thread_queue_init_parameters

Public Functions

thread_queue_init_parameters(std::int64_t max_thread_count = std::int64_t(HPX_THREAD_QUEUE_MAX_THREAD_COUNT), std::int64_t min_tasks_to_steal_pending = std::int64_t(HPX_THREAD_QUEUE_MIN_TASKS_TO_STEAL_PENDING), std::int64_t min_tasks_to_steal_staged = std::int64_t(HPX_THREAD_QUEUE_MIN_TASKS_TO_STEAL_STAGED), std::int64_t min_add_new_count = std::int64_t(HPX_THREAD_QUEUE_MIN_ADD_NEW_COUNT), std::int64_t max_add_new_count = std::int64_t(HPX_THREAD_QUEUE_MAX_ADD_NEW_COUNT), std::int64_t min_delete_count = std::int64_t(HPX_THREAD_QUEUE_MIN_DELETE_COUNT), std::int64_t max_delete_count = std::int64_t(HPX_THREAD_QUEUE_MAX_DELETE_COUNT), std::int64_t max_terminated_threads = std::int64_t(HPX_THREAD_QUEUE_MAX_TERMINATED_THREADS), double max_idle_backoff_time = double(HPX_IDLE_BACKOFF_TIME_MAX), std::ptrdiff_t small_stacksize = HPX_SMALL_STACK_SIZE, std::ptrdiff_t medium_stacksize = HPX_MEDIUM_STACK_SIZE, std::ptrdiff_t large_stacksize = HPX_LARGE_STACK_SIZE, std::ptrdiff_t huge_stacksize = HPX_HUGE_STACK_SIZE)

Public Members

std::int64_t max_thread_count_
std::int64_t min_tasks_to_steal_pending_
std::int64_t min_tasks_to_steal_staged_
std::int64_t min_add_new_count_
std::int64_t max_add_new_count_
std::int64_t min_delete_count_
std::int64_t max_delete_count_
std::int64_t max_terminated_threads_
double max_idle_backoff_time_
const std::ptrdiff_t small_stacksize_
const std::ptrdiff_t medium_stacksize_
const std::ptrdiff_t large_stacksize_
const std::ptrdiff_t huge_stacksize_
const std::ptrdiff_t nostack_stacksize_
namespace hpx
namespace threads
template<typename T>
class thread_specific_ptr

Public Types

typedef T element_type

Public Functions

thread_specific_ptr()
thread_specific_ptr(void (*func_)(T*))
~thread_specific_ptr()
T *get() const
T *operator->() const
T &operator*() const
T *release()
void reset(T *new_value = nullptr)

Private Types

typedef coroutines::detail::tss_cleanup_function cleanup_function

Private Functions

thread_specific_ptr(thread_specific_ptr&)
thread_specific_ptr &operator=(thread_specific_ptr&)

Private Members

std::shared_ptr<cleanup_function> cleanup_
struct delete_data : public tss_cleanup_function

Public Functions

template<>
void operator()(void *data)
struct run_custom_cleanup_function : public tss_cleanup_function

Public Functions

template<>
run_custom_cleanup_function(void (*cleanup_function_)(T*))
template<>
void operator()(void *data)

Public Members

template<>
void (*cleanup_function)(T*)
template<>
struct hash<::hpx::threads::thread_id>

Public Functions

std::size_t operator()(::hpx::threads::thread_id const &v) const
namespace std
template<>
struct hash<::hpx::threads::thread_id>

Public Functions

std::size_t operator()(::hpx::threads::thread_id const &v) const