std::mutex in shared memory not working

前端 未结 3 1092
庸人自扰
庸人自扰 2020-12-21 14:24

I have a scenario where the shared memory area is exclusively accessed by two different processes. When I launch the processes, the first process successfully locks the mute

3条回答
  •  爱一瞬间的悲伤
    2020-12-21 15:31

    An std::mutex instance is only scoped to a single process; it is not capable of interprocess synchronization/concurrency. It is only capable of synchronizing child threads within a parent process.

    Look to use Boost or an interprocess synchronization library instead.

提交回复
热议问题