如何创建托管的共享内存段的同步机制? [英] How do I create synchronization mechanisms in managed shared memory segments?

查看:219
本文介绍了如何创建托管的共享内存段的同步机制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有2个进程通过STL容器沟通 - 所以我决定用管理共享内存。我试图实现它们之间的一些同步 - 对于一个scoped_lock中开始的interprocess_mutex - 但我没有多少运气。它应该是怎样做?

I'm trying to have 2 processes communicate via an stl container - so I've decided to use the managed shared memory. I'm trying to implement some synchronisation between them - an interprocess_mutex for a start with a scoped_lock - but I'm not having much luck. How is it supposed to be done?

推荐答案

我认为最好的办法是一个容器处理程序,所有访问(的getter / setter)的容器通过处理程序。因此,在此处理程序,你可以很容易地实现同步。

I think the best solution is a container handler, and all access (getter/setter) to the container through the handler. So in this handler you could implement the synchronisation easily.

Salu2。

这篇关于如何创建托管的共享内存段的同步机制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆