Skip to content

Commit

Permalink
Merge pull request #282 from jchen8tw/master
Browse files Browse the repository at this point in the history
Fix Multiple Definition Compilation Error in ThreadPool
  • Loading branch information
hosseinmoein committed Jan 17, 2024
2 parents aa02efc + 7922667 commit b8067bc
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions include/DataFrame/Utils/Threads/ThreadPool.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace hmdf
{

ThreadPool::ThreadPool(size_type thr_num) {
inline ThreadPool::ThreadPool(size_type thr_num) {

threads_.reserve(thr_num * 2);
for (size_type i = 0; i < thr_num; ++i) {
Expand All @@ -57,7 +57,7 @@ ThreadPool::ThreadPool(size_type thr_num) {

// ----------------------------------------------------------------------------

ThreadPool::~ThreadPool() {
inline ThreadPool::~ThreadPool() {

shutdown();
for (auto &routine : threads_)
Expand All @@ -67,7 +67,7 @@ ThreadPool::~ThreadPool() {

// ----------------------------------------------------------------------------

bool
inline bool
ThreadPool::add_thread(size_type thr_num) {

if (is_shutdown())
Expand Down Expand Up @@ -346,39 +346,39 @@ ThreadPool::parallel_sort(const I begin, const I end, P compare) {

// ----------------------------------------------------------------------------

ThreadPool::size_type
inline ThreadPool::size_type
ThreadPool::available_threads() const noexcept {

return (available_threads_.load(std::memory_order_relaxed));
}

// ----------------------------------------------------------------------------

ThreadPool::size_type
inline ThreadPool::size_type
ThreadPool::capacity_threads() const noexcept {

return (capacity_threads_.load(std::memory_order_relaxed));
}

// ----------------------------------------------------------------------------

bool
inline bool
ThreadPool::is_shutdown() const noexcept {

return (shutdown_flag_.load(std::memory_order_relaxed));
}

// ----------------------------------------------------------------------------

ThreadPool::size_type
inline ThreadPool::size_type
ThreadPool::pending_tasks() const noexcept {

return (global_queue_.size());
}

// ----------------------------------------------------------------------------

bool
inline bool
ThreadPool::shutdown() noexcept {

bool expected { false };
Expand All @@ -400,7 +400,7 @@ ThreadPool::shutdown() noexcept {

// ----------------------------------------------------------------------------

ThreadPool::WorkUnit
inline ThreadPool::WorkUnit
ThreadPool::get_one_local_task_() noexcept {

WorkUnit work_unit;
Expand All @@ -423,7 +423,7 @@ ThreadPool::get_one_local_task_() noexcept {

// ----------------------------------------------------------------------------

bool
inline bool
ThreadPool::run_task() noexcept {

WorkUnit work_unit = get_one_local_task_();
Expand All @@ -445,7 +445,7 @@ ThreadPool::run_task() noexcept {

// ----------------------------------------------------------------------------

bool
inline bool
ThreadPool::thread_routine_(size_type local_q_idx) noexcept {

if (is_shutdown())
Expand Down

0 comments on commit b8067bc

Please sign in to comment.