diff --git a/include/ThreadPool.h b/include/ThreadPool.h index b7bf84d..fb21559 100644 --- a/include/ThreadPool.h +++ b/include/ThreadPool.h @@ -18,7 +18,7 @@ class ThreadPool { ThreadPool * m_pool; public: ThreadWorker(ThreadPool * pool, const int id) - : m_pool(pool), m_id(id) { + : m_id(id), m_pool(pool) { } void operator()() { @@ -39,9 +39,9 @@ class ThreadPool { } }; + std::vector m_threads; bool m_shutdown; SafeQueue> m_queue; - std::vector m_threads; std::mutex m_conditional_mutex; std::condition_variable m_conditional_lock; public: @@ -57,7 +57,7 @@ class ThreadPool { // Inits thread pool void init() { - for (int i = 0; i < m_threads.size(); ++i) { + for (size_t i = 0; i < m_threads.size(); ++i) { m_threads[i] = std::thread(ThreadWorker(this, i)); } } @@ -67,7 +67,7 @@ class ThreadPool { m_shutdown = true; m_conditional_lock.notify_all(); - for (int i = 0; i < m_threads.size(); ++i) { + for (size_t i = 0; i < m_threads.size(); ++i) { if(m_threads[i].joinable()) { m_threads[i].join(); }