/** Enqueue a work item */ bool Enqueue(WorkItem* item) { boost::unique_lock<boost::mutex> lock(cs); if (queue.size() >= maxDepth) { return false; } queue.push_back(item); cond.notify_one(); return true; }
/** Enqueue a work item */ bool Enqueue(WorkItem* item) { boost::unique_lock<boost::mutex> lock(cs); if (queue.size() >= maxDepth) { return false; } queue.emplace_back(std::unique_ptr<WorkItem>(item)); cond.notify_one(); return true; }