最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - Is thread A guaranteed to finally see a change from thread B in a infinite loop without synchronization? - Stack Overflow

programmeradmin3浏览0评论

Supposing I have an unsynchronized atomic flag is_finished. In the following code:

// thread A
while(!is_finished.test(memory_order_relaxed)) {
    // supposing I have some observable side effects here
}
// thread B
is_finished.test_and_set(memory_order_relaxed);

If these two threads run concurrently, will thread A always end?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论