diff --git a/examples/server/server.cpp b/examples/server/server.cpp index 109dbc023..5f2238d61 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -412,6 +412,7 @@ struct server_queue { // multi-task version of post() int post(std::vector & tasks, bool front = false) { + std::unique_lock lock(mutex_tasks); for (auto & task : tasks) { if (task.id == -1) { task.id = id++;