MCPcopy Create free account
hub / github.com/CommE2E/comm / scheduleTask

Method scheduleTask

native/cpp/CommonCpp/Tools/WorkerThread.cpp:22–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22void 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
31WorkerThread::~WorkerThread() {
32 this->tasks.push(nullptr);

Calls 1

try_pushMethod · 0.80

Tested by

no test coverage detected