thread_pool_util

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

Functions

hpx::future<void> resume_processing_unit(thread_pool_base &pool, std::size_t virt_core)

Resumes the given processing unit. When the processing unit has been resumed the returned future will be ready.

Note

Can only be called from an HPX thread. Use resume_processing_unit_cb or to resume the processing unit from outside HPX. Requires that the pool has threads::policies::enable_elasticity set.

Return

A future<void> which is ready when the given 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.

void resume_processing_unit_cb(thread_pool_base &pool, util::function_nonser<void(void)> callback, std::size_t virt_core, error_code &ec = throws, )

Resumes the given processing unit. Takes a callback as a parameter which will be called when the processing unit has been resumed.

Note

Requires that the pool has threads::policies::enable_elasticity set.

Parameters
  • callback: [in] Callback which is called when the processing unit has been suspended.

  • virt_core: [in] The processing unit to resume.

  • 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.

hpx::future<void> suspend_processing_unit(thread_pool_base &pool, std::size_t virt_core)

Suspends the given processing unit. When the processing unit has been suspended the returned future will be ready.

Note

Can only be called from an HPX thread. Use suspend_processing_unit_cb or to suspend the processing unit from outside HPX. Requires that the pool has threads::policies::enable_elasticity set.

Return

A future<void> which is ready when the given 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.

Exceptions
  • hpx::exception: if called from outside the HPX runtime.

void suspend_processing_unit_cb(util::function_nonser<void(void)> callback, thread_pool_base &pool, std::size_t virt_core, error_code &ec = throws, )

Suspends the given processing unit. Takes a callback as a parameter which will be called when the processing unit has been suspended.

Note

Requires that the pool has threads::policies::enable_elasticity set.

Parameters
  • callback: [in] Callback which is called when the processing unit has been suspended.

  • virt_core: [in] The processing unit to suspend.

  • 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.

hpx::future<void> resume_pool(thread_pool_base &pool)

Resumes the thread pool. When the all OS threads on the thread pool have been resumed the returned future will be ready.

Note

Can only be called from an HPX thread. Use resume_cb or resume_direct to suspend the pool from outside HPX.

Return

A future<void> which is ready when the thread pool has been resumed.

Exceptions
  • hpx::exception: if called from outside the HPX runtime.

void resume_pool_cb(thread_pool_base &pool, util::function_nonser<void(void)> callback, error_code &ec = throws, )

Resumes the thread pool. Takes a callback as a parameter which will be called when all OS threads on the thread pool have been resumed.

Parameters
  • callback: [in] called when the thread pool has been resumed.

  • 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.

hpx::future<void> suspend_pool(thread_pool_base &pool)

Suspends the thread pool. When the all OS threads on the thread pool have been suspended the returned future will be ready.

Note

Can only be called from an HPX thread. Use suspend_cb or suspend_direct to suspend the pool from outside HPX. A thread pool cannot be suspended from an HPX thread running on the pool itself.

Return

A future<void> which is ready when the thread pool has been suspended.

Exceptions
  • hpx::exception: if called from outside the HPX runtime.

void suspend_pool_cb(thread_pool_base &pool, util::function_nonser<void(void)> callback, error_code &ec = throws, )

Suspends the thread pool. Takes a callback as a parameter which will be called when 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
  • callback: [in] called when the thread pool has been suspended.

  • 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.