| 20 | } |
| 21 | |
| 22 | void WorkerThread::scheduleTask(const taskType task) { |
| 23 | if (!this->tasks.try_push(std::make_unique<taskType>(std::move(task)))) { |
| 24 | std::string errorMessage{ |
| 25 | "Error scheduling task on the " + this->name + " worker thread"}; |
| 26 | Logger::log(errorMessage); |
| 27 | throw std::runtime_error(errorMessage); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | WorkerThread::~WorkerThread() { |
| 32 | this->tasks.push(nullptr); |
no test coverage detected