hpx/schedulers/thread_queue.hpp¶
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace
hpx
-
namespace
threads
-
namespace
policies
-
template<typename
Mutex
, typenamePendingQueuing
, typenameStagedQueuing
, typenameTerminatedQueuing
>
classthread_queue
¶ Public Functions
-
bool
cleanup_terminated_locked
(bool delete_all = false)¶ This function makes sure all threads which are marked for deletion (state is terminated) are properly destroyed.
This returns ‘true’ if there are no more terminated threads waiting to be deleted.
-
bool
cleanup_terminated
(bool delete_all = false)¶
-
thread_queue
(std::size_t queue_num = std::size_t(-1), thread_queue_init_parameters parameters = {})¶
-
~thread_queue
()¶
-
void
create_thread
(thread_init_data &data, thread_id_ref_type *id, error_code &ec)¶
-
bool
get_next_thread
(threads::thread_id_ref_type &thrd, bool allow_stealing = false, bool steal = false)¶ Return the next thread to be executed, return false if none is available
-
void
schedule_thread
(threads::thread_id_ref_type thrd, bool other_end = false)¶ Schedule the passed thread.
-
void
destroy_thread
(threads::thread_data *thrd)¶ Destroy the passed thread as it has been terminated.
-
std::int64_t
get_thread_count
(thread_schedule_state state = thread_schedule_state::unknown) const¶ Return the number of existing threads with the given state.
-
void
abort_all_suspended_threads
()¶
-
bool
enumerate_threads
(hpx::function<bool(thread_id_type)> const &f, thread_schedule_state state = thread_schedule_state::unknown, ) const¶
-
bool
wait_or_add_new
(bool, std::size_t &added, bool steal = false)¶ This is a function which gets called periodically by the thread manager to allow for maintenance tasks to be executed in the scheduler. Returns true if the OS thread calling this function has to be terminated (i.e. no more work has to be done).
Public Static Functions
-
static void
deallocate
(threads::thread_data *p)¶
Protected Functions
-
template<typename
Lock
>
voidcreate_thread_object
(threads::thread_id_ref_type &thrd, threads::thread_init_data &data, Lock &lk)¶
-
std::size_t
add_new
(std::int64_t add_count, thread_queue *addfrom, std::unique_lock<mutex_type> &lk, bool steal = false)¶
-
bool
add_new_always
(std::size_t &added, thread_queue *addfrom, std::unique_lock<mutex_type> &lk, bool steal = false)¶
-
void
recycle_thread
(thread_id_type thrd)¶
Protected Static Attributes
-
util::internal_allocator<typename thread_queue<Mutex, PendingQueuing, StagedQueuing, TerminatedQueuing>::task_description>
task_description_alloc_
¶
Private Types
-
template<>
usingmutex_type
= Mutex¶
-
template<>
usingthread_map_type
= std::unordered_set<thread_id_type, std::hash<thread_id_type>, std::equal_to<thread_id_type>, util::internal_allocator<thread_id_type>>¶
-
template<>
usingthread_heap_type
= std::vector<thread_id_type, util::internal_allocator<thread_id_type>>¶
-
template<>
usingthread_description_ptr
= typename thread_id_ref_type::thread_repr*¶
-
template<>
usingwork_items_type
= typename PendingQueuing::template apply<thread_description_ptr>::type¶
-
template<>
usingtask_items_type
= typename StagedQueuing::template apply<task_description*>::type¶
-
template<>
usingterminated_items_type
= typename TerminatedQueuing::template apply<thread_data*>::type¶
Private Members
-
thread_queue_init_parameters
parameters_
¶
-
mutex_type
mtx_
¶
-
thread_map_type
thread_map_
¶
-
work_items_type
work_items_
¶
-
terminated_items_type
terminated_items_
¶
-
task_items_type
new_tasks_
¶
-
thread_heap_type
thread_heap_small_
¶
-
thread_heap_type
thread_heap_medium_
¶
-
thread_heap_type
thread_heap_large_
¶
-
thread_heap_type
thread_heap_huge_
¶
-
thread_heap_type
thread_heap_nostack_
¶
-
util::cache_line_data<std::atomic<std::int64_t>>
new_tasks_count_
¶
-
util::cache_line_data<std::atomic<std::int64_t>>
work_items_count_
¶
-
struct
task_description
¶ Public Members
-
template<>
thread_init_datadata
¶
-
template<>
-
bool
-
template<typename
-
namespace
-
namespace