void unschedule(const task_handle& handle) { { std::lock_guard<std::mutex> lk(mutex); auto handle_it = std::find(handles.begin(), handles.end(), handle); if (handle_it != handles.end()) { tasks.erase(handle); todo.remove(handle); handles.erase(handle_it); } } tasks_updated.notify_all(); }