You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
600 B

#ifndef THREADPOOL_HPP
#define THREADPOOL_HPP
#include <vector>
#include "ConcurrentDeque.hpp"
#include "Task.hpp"
#include "Thread.hpp"
#include "Mutex.hpp"
class ThreadPool
{
public:
ThreadPool();
~ThreadPool();
void pushTask(Task* task);
Task* popTask();
void pushWorkerThread(Thread * thread);
void startWorkerThreads();
void stop();
void join() const;
private:
ThreadPool(const ThreadPool&);
ThreadPool& operator=(const ThreadPool&);
std::vector<Thread*> m_threads;
ConcurrentDeque<Task*> m_tasks;
};
#endif // THREADPOOL_HPP */