Skip to content

Commit

Permalink
Changed nontemplates member to inline
Browse files Browse the repository at this point in the history
This change allows the "library" to stay
header only. This might not be best practice
but helps keeping the more educational code
compact.
  • Loading branch information
progschj committed Apr 5, 2013
1 parent 951db75 commit 7d93717
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#include <functional>
#include <stdexcept>

class ThreadPool;

// the actual thread pool
class ThreadPool {
public:
ThreadPool(size_t);
Expand All @@ -34,7 +31,7 @@ class ThreadPool {
};

// the constructor just launches some amount of workers
ThreadPool::ThreadPool(size_t threads)
inline ThreadPool::ThreadPool(size_t threads)
: stop(false)
{
for(size_t i = 0;i<threads;++i)
Expand Down Expand Up @@ -82,7 +79,7 @@ auto ThreadPool::enqueue(F&& f, Args&&... args)
}

// the destructor joins all threads
ThreadPool::~ThreadPool()
inline ThreadPool::~ThreadPool()
{
stop = true;
condition.notify_all();
Expand Down

0 comments on commit 7d93717

Please sign in to comment.