未验证 提交 402f776b 编写于 作者: S sneaxiy 提交者: GitHub

fix ipc counter (#52977)

上级 861a12ff
......@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <sys/mman.h>
#include <atomic>
#include <random>
#include <string>
......@@ -34,12 +35,15 @@ namespace allocation {
std::string GetIPCName() {
static std::random_device rd;
static std::atomic<uint64_t> counter{0};
std::string handle = "/paddle_";
#ifdef _WIN32
handle += std::to_string(GetCurrentProcessId());
#else
handle += std::to_string(getpid());
#endif
handle += "_";
handle += counter.fetch_add(1);
handle += "_";
handle += std::to_string(rd());
return handle;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册