Skip to content

Commit 7d93717

Browse files
committed
Changed nontemplates member to inline
This change allows the "library" to stay header only. This might not be best practice but helps keeping the more educational code compact.
1 parent 951db75 commit 7d93717

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

ThreadPool.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
#include <functional>
1212
#include <stdexcept>
1313

14-
class ThreadPool;
15-
16-
// the actual thread pool
1714
class ThreadPool {
1815
public:
1916
ThreadPool(size_t);
@@ -34,7 +31,7 @@ class ThreadPool {
3431
};
3532

3633
// the constructor just launches some amount of workers
37-
ThreadPool::ThreadPool(size_t threads)
34+
inline ThreadPool::ThreadPool(size_t threads)
3835
: stop(false)
3936
{
4037
for(size_t i = 0;i<threads;++i)
@@ -82,7 +79,7 @@ auto ThreadPool::enqueue(F&& f, Args&&... args)
8279
}
8380

8481
// the destructor joins all threads
85-
ThreadPool::~ThreadPool()
82+
inline ThreadPool::~ThreadPool()
8683
{
8784
stop = true;
8885
condition.notify_all();

0 commit comments

Comments
 (0)