MCPcopy Create free account
hub / github.com/bshoshany/thread-pool / pause

Function pause

include/BS_thread_pool.hpp:1725–1730  ·  view source on GitHub ↗

* @brief Pause the pool. The workers will temporarily stop retrieving new tasks out of the queue, although any tasks already executing will keep running until they are finished. Only enabled if the flag `BS::tp::pause` is enabled in the template parameter. */

Source from the content-addressed store, hash-verified

1723 * @brief Pause the pool. The workers will temporarily stop retrieving new tasks out of the queue, although any tasks already executing will keep running until they are finished. Only enabled if the flag `BS::tp::pause` is enabled in the template parameter.
1724 */
1725 BS_THREAD_POOL_IF_PAUSE_ENABLED
1726 void pause()
1727 {
1728 const std::scoped_lock tasks_lock(tasks_mutex);
1729 paused = true;
1730 }
1731
1732 /**
1733 * @brief Purge all the tasks waiting in the queue. Tasks that are currently running will not be affected, but any tasks still waiting in the queue will be discarded, and will never be executed by the threads. Please note that there is no way to restore the purged tasks.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected