gpt4 book ai didi

c++ - 观察 QSharedMemory 的变化

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:51:33 24 4
gpt4 key购买 nike

我有一个 QSharedMemory以防止我的应用程序的两个进程同时运行。进程 A 在启动时将 QSharedMemory 设置为“锁定”。现在我的进程 B 设置了一个值,例如“请回到前台”。

进程 A 是否有一种简单的方法来观察 QSharedMemory 中的变化,即避免实现愚蠢的拉取计时器?

最佳答案

我们在这里:QSystemSemaphore

Like its lighter counterpart QSemaphore, a QSystemSemaphore can be accessed from multiple threads. Unlike QSemaphore, a QSystemSemaphore can also be accessed from multiple processes.

QSharedMemory一样,QSystemSemaphore使用了基于键的访问方式。

关于c++ - 观察 QSharedMemory 的变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37121384/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com