We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a222ee7 commit f6f46d4Copy full SHA for f6f46d4
1 file changed
cpp_utils/src/cpp/thread_pool/task/TaskId.cpp
@@ -18,7 +18,7 @@
18
* This file contains class TaskId implementation.
19
*/
20
21
-#include <random>
+#include <atomic>
22
23
#include <cpp_utils/thread_pool/task/TaskId.hpp>
24
@@ -27,7 +27,8 @@ namespace utils {
27
28
TaskId new_unique_task_id()
29
{
30
- return static_cast<TaskId>(std::rand());
+ static std::atomic<TaskId> unique_task_id_{0};
31
+ return unique_task_id_++;
32
}
33
34
} /* namespace utils */
0 commit comments