diff --git a/include/nana/threads/pool.hpp b/include/nana/threads/pool.hpp index 38d9952e..1234bcb2 100644 --- a/include/nana/threads/pool.hpp +++ b/include/nana/threads/pool.hpp @@ -1,6 +1,6 @@ /* * A Thread Pool Implementation - * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -13,10 +13,14 @@ #ifndef NANA_THREADS_POOL_HPP #define NANA_THREADS_POOL_HPP +#include #include #include #include +#ifndef STD_THREAD_NOT_SUPPORTED +# include +#endif namespace nana{ /// Some mutex classes for synchronizing. @@ -58,9 +62,12 @@ namespace threads pool(const pool&) = delete; pool& operator=(const pool&) = delete; public: - pool(); ///< Creates a group of threads. +#ifndef STD_THREAD_NOT_SUPPORTED + pool(unsigned thread_number = std::thread::hardware_concurrency()); ///< Creates a group of threads. +#else + pool(unsigned thread_number = 0); +#endif pool(pool&&); - pool(std::size_t thread_number); ///< Creates a number of threads specifed by thread_number. ~pool(); ///< waits for the all running tasks till they are finished and skips all the queued tasks. pool& operator=(pool&&); diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index a2f81c39..e04c4ab8 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -2086,7 +2086,7 @@ namespace nana{ namespace widgets void text_editor::copy() const { - //Stops copying text if the text_editor is masked. + //Disallows copying text if the text_editor is masked. if (mask_char_) return; diff --git a/source/threads/pool.cpp b/source/threads/pool.cpp index e83498b0..d4b3af2f 100644 --- a/source/threads/pool.cpp +++ b/source/threads/pool.cpp @@ -351,10 +351,17 @@ namespace threads }container_; };//end class impl - pool::pool() - : impl_(new impl(4)) +#ifndef STD_THREAD_NOT_SUPPORTED + pool::pool(unsigned thread_number) + : impl_(new impl(thread_number ? thread_number : std::thread::hardware_concurrency())) { } +#else + pool::pool(unsigned thread_number) + : impl_(new impl(0)) + { + } +#endif pool::pool(pool&& other) : pool() @@ -362,11 +369,6 @@ namespace threads std::swap(impl_, other.impl_); } - pool::pool(std::size_t thread_number) - : impl_(new impl(thread_number)) - { - } - pool& pool::operator=(pool&& other) { if(this != &other)