增强共享内存。当前有多少进程正在使用共享内存?
我使用 boost 库在进程之间共享一些内存;
升压::进程间::托管_共享内存管理_shm(升压::进程间::open_or_create,“shm”,1024);
有没有办法找出当前有多少进程正在访问该内存?
I am sharing some memory between processes, using the boost library;
boost::interprocess::managed_shared_memory managed_shm(boost::interprocess::open_or_create, "shm", 1024);
is there a way to find out how many processes are currently accessing this memory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您可以获得底层 SHM ID,则可以使用 shmctl 函数来获取附加了该段的进程数。
If you can get the underlying SHM ID, you can use shmctl function to get the number of processes having the segment attached.