hpx/schedulers/local_priority_queue_scheduler.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
¶ Typedefs
-
using
default_local_priority_queue_scheduler_terminated_queue
= lockfree_fifo¶
-
template<typename
Mutex
= std::mutex, typenamePendingQueuing
= lockfree_fifo, typenameStagedQueuing
= lockfree_fifo, typenameTerminatedQueuing
= default_local_priority_queue_scheduler_terminated_queue>
classlocal_priority_queue_scheduler
: public scheduler_base¶ - #include <local_priority_queue_scheduler.hpp>
The local_priority_queue_scheduler maintains exactly one queue of work items (threads) per OS thread, where this OS thread pulls its next work from. Additionally it maintains separate queues: several for high priority threads and one for low priority threads. High priority threads are executed by the first N OS threads before any other work is executed. Low priority threads are executed by the last OS thread whenever no other work is available.
Public Types
-
typedef thread_queue<Mutex, PendingQueuing, StagedQueuing, TerminatedQueuing>
thread_queue_type
¶
-
typedef init_parameter
init_parameter_type
¶
Public Functions
-
local_priority_queue_scheduler
(init_parameter_type const &init, bool deferred_initialization = true)¶
-
~local_priority_queue_scheduler
()¶
-
void
abort_all_suspended_threads
()¶
-
bool
cleanup_terminated
(bool delete_all)¶
-
void
create_thread
(thread_init_data &data, thread_id_ref_type *id, error_code &ec)¶
-
bool
get_next_thread
(std::size_t num_thread, bool running, threads::thread_id_ref_type &thrd, bool enable_stealing)¶
-
void
schedule_thread
(threads::thread_id_ref_type thrd, threads::thread_schedule_hint schedulehint, bool allow_fallback = false, thread_priority priority = thread_priority::normal)¶ Schedule the passed thread.
-
void
schedule_thread_last
(threads::thread_id_ref_type thrd, threads::thread_schedule_hint schedulehint, bool allow_fallback = false, thread_priority priority = thread_priority::normal)¶
-
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, thread_priority priority = thread_priority::default_, std::size_t num_thread = std::size_t(-1), bool = false) const¶
-
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
(std::size_t num_thread, bool running, std::int64_t &idle_loop_count, bool enable_stealing, std::size_t &added)¶ 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).
-
void
reset_thread_distribution
()¶
Protected Attributes
-
detail::affinity_data const &
affinity_data_
¶
-
thread_queue_type
low_priority_queue_
¶
-
std::vector<util::cache_line_data<thread_queue_type*>>
queues_
¶
-
std::vector<util::cache_line_data<thread_queue_type*>>
high_priority_queues_
¶
-
struct
init_parameter
¶ Public Functions
-
template<>
init_parameter
(std::size_t num_queues, detail::affinity_data const &affinity_data, std::size_t num_high_priority_queues = std::size_t(-1), thread_queue_init_parameters thread_queue_init = {}, char const *description = "local_priority_queue_scheduler")¶
-
template<>
-
typedef thread_queue<Mutex, PendingQueuing, StagedQueuing, TerminatedQueuing>
-
using
-
namespace
-
namespace