Skip to content

Commit

Permalink
use hardware_concurrency() by default for number of threads
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Dec 7, 2016
1 parent bafac7c commit f8ab903
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/global_thread_pool.cpp
Expand Up @@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// ====================================================================

#include "global_thread_pool.hpp"
#include "thread_pool.hpp"

#ifdef ENABLE_THREADS
Expand All @@ -24,7 +25,7 @@

namespace flexiblesusy {

Thread_pool global_thread_pool(std::thread::hardware_concurrency());
Thread_pool global_thread_pool;

} // namespace flexiblesusy

Expand Down
3 changes: 2 additions & 1 deletion src/thread_pool.hpp
Expand Up @@ -27,6 +27,7 @@

#include <future>
#include <memory>
#include <thread>
#include <boost/asio.hpp>
#include <boost/thread.hpp>

Expand All @@ -36,7 +37,7 @@ class Thread_pool {
public:
using worker_t = std::unique_ptr<boost::asio::io_service::work>;

Thread_pool(std::size_t pool_size)
Thread_pool(std::size_t pool_size = std::thread::hardware_concurrency())
: io_service()
, work(new worker_t::element_type(io_service))
{
Expand Down

0 comments on commit f8ab903

Please sign in to comment.