gpt4 book ai didi

boost - Boost msm 中的线程安全

转载 作者:行者123 更新时间:2023-12-03 17:59:43 24 4
gpt4 key购买 nike

我是 boost 元状态库的新手。我正在构建一个应用程序,我必须在其中使用 msm。

我的应用程序有两个线程,它们使用相同的 msm 对象作为共享资源。如果两个线程都在同一个 msm 对象上调用 process_event,那么 msm 是否是线程安全的?

欢迎任何想法。

最佳答案

引用 Christophe Henry,当您在 Boost.Users 列表中提问时他回答了这个问题:

msm is as thread-safe as a STL container: it's not. Different threads should not call process_event on the same state machine object. This means you'll have to serialize your calls to the object through a synchronization mechanism.

关于boost - Boost msm 中的线程安全,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14931691/

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