io_service¶
The contents of this module can be included with the header
hpx/modules/io_service.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/io_service.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 -
class
io_service_pool¶ - #include <io_service_pool.hpp>
A pool of io_service objects.
Public Functions
-
HPX_NON_COPYABLE(io_service_pool)¶
-
io_service_pool(std::size_t pool_size = 2, threads::policies::callback_notifier const ¬ifier = threads::policies::callback_notifier(), char const *pool_name = "", char const *name_postfix = "")¶ Construct the io_service pool.
- Parameters
pool_size: [in] The number of threads to run to serve incoming requestsstart_thread: [in]
-
io_service_pool(threads::policies::callback_notifier const ¬ifier, char const *pool_name = "", char const *name_postfix = "")¶ Construct the io_service pool.
- Parameters
start_thread: [in]
-
~io_service_pool()¶
-
bool
run(bool join_threads = true, barrier *startup = nullptr)¶ Run all io_service objects in the pool. If join_threads is true this will also wait for all threads to complete
-
bool
run(std::size_t num_threads, bool join_threads = true, barrier *startup = nullptr)¶ Run all io_service objects in the pool. If join_threads is true this will also wait for all threads to complete
-
void
stop()¶ Stop all io_service objects in the pool.
-
void
join()¶ Join all io_service threads in the pool.
-
void
clear()¶ Clear all internal data structures.
-
void
wait()¶ Wait for all work to be done.
-
bool
stopped()¶
-
asio::io_context &
get_io_service(int index = -1)¶ Get an io_service to use.
-
void
thread_run(std::size_t index, barrier *startup = nullptr)¶ Activate the thread index for this thread pool.
-
char const *
get_name() const¶ Return name of this pool.
Protected Functions
-
void
stop_locked()¶
-
void
join_locked()¶
-
void
clear_locked()¶
-
void
wait_locked()¶
Private Types
-
using
work_type= asio::io_context::work¶
Private Members
-
std::vector<io_service_ptr>
io_services_¶ The pool of io_services.
-
bool
stopped_¶ set to true if stopped
-
threads::policies::callback_notifier const &
notifier_¶ call this for each thread start/stop
-
char const *
pool_name_¶
-
char const *
pool_name_postfix_¶
-
bool
waiting_¶ Set to true if waiting for work to finish.
-
-
class
-
namespace