mirror of
https://github.com/bshoshany/thread-pool.git
synced 2026-07-21 19:13:00 +04:00
Updated to v1.9
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
## Version history
|
||||
|
||||
* v1.9 (2021-07-29)
|
||||
* Fixed a bug in `reset()` which caused it to create the wrong number of threads.
|
||||
* v1.8 (2021-07-28)
|
||||
* The version history has become too long to be included in `README.md`, so I moved it to a separate file, `CHANGELOG.md`.
|
||||
* A button to open this repository directly in Visual Studio Code has been added to the badges in `README.md`.
|
||||
|
||||
+5
-3
@@ -3,8 +3,8 @@
|
||||
/**
|
||||
* @file thread_pool.hpp
|
||||
* @author Barak Shoshany (baraksh@gmail.com) (http://baraksh.com)
|
||||
* @version 1.8
|
||||
* @date 2021-07-28
|
||||
* @version 1.9
|
||||
* @date 2021-07-29
|
||||
* @copyright Copyright (c) 2021 Barak Shoshany. Licensed under the MIT license. If you use this library in published research, please cite it as follows:
|
||||
* - Barak Shoshany, "A C++17 Thread Pool for High-Performance Scientific Computing", doi:10.5281/zenodo.4742687, arXiv:2105.00613 (May 2021)
|
||||
*
|
||||
@@ -12,6 +12,8 @@
|
||||
* @details A modern C++17-compatible thread pool implementation, built from scratch with high-performance scientific computing in mind. The thread pool is implemented as a single lightweight and self-contained class, and does not have any dependencies other than the C++17 standard library, thus allowing a great degree of portability. In particular, this implementation does not utilize OpenMP or any other high-level multithreading APIs, and thus gives the programmer precise low-level control over the details of the parallelization, which permits more robust optimizations. The thread pool was extensively tested on both AMD and Intel CPUs with up to 40 cores and 80 threads. Other features include automatic generation of futures and easy parallelization of loops. Two helper classes enable synchronizing printing to an output stream by different threads and measuring execution time for benchmarking purposes. Please visit the GitHub repository at https://github.com/bshoshany/thread-pool for documentation and updates, or to submit feature requests and bug reports.
|
||||
*/
|
||||
|
||||
#define THREAD_POOL_VERSION 1.9
|
||||
|
||||
#include <atomic> // std::atomic
|
||||
#include <chrono> // std::chrono
|
||||
#include <cstdint> // std::int_fast64_t, std::uint_fast32_t
|
||||
@@ -196,8 +198,8 @@ public:
|
||||
thread_count = _thread_count ? _thread_count : std::thread::hardware_concurrency();
|
||||
threads.reset(new std::thread[thread_count]);
|
||||
paused = was_paused;
|
||||
create_threads();
|
||||
running = true;
|
||||
create_threads();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user