This boost example on condition variables表明在调用cond.notify_one()
期间互斥锁不必保持。这是否暗示boost::condition_variable
是线程安全的?即如果“准备数据”线程释放互斥并尝试呼叫cond.notify_one()
,而另一线程现在获取释放的互斥并同时尝试呼叫cond.wait(...)
,会发生什么?boost :: condition_variable线程安全吗?
1
A
回答
2
该示例并不意味着boost::condition_variable
是线程安全的。然而,wait
,wait_for
,wait_until
,notify_one
和 notify_all
是线程安全的成员函数。
Boost.Thread记录它的conformance and extension of the C++11 standard Thread library。它列出了条件变量,类别condition_variable
和类别condition_variable_any
符合要求。
标准(第30.5-2)的相关部分规定:
条件变量允许的
wait
,wait_for
,wait_until
,notify_one
和notify_all
成员函数并发调用。
相关问题
- 1. std :: condition_variable是线程安全的吗?
- 2. 线程同步与boost :: condition_variable
- 3. boost :: asio :: deadline_timer线程安全吗?
- 4. 是boost :: detail :: atomic_count线程安全吗?
- 5. 是boost :: interprocess线程安全吗?
- 6. Boost图:add_edge和remove_edge线程安全吗?
- 7. Boost BGL线程安全
- 8. java线程安全:线程安全吗?
- 9. cocos2d isTouchEnabled线程安全吗?
- 10. 是winsock2线程安全吗?
- 11. 在Boost中的线程安全msm
- 12. 线程安全担保的boost ::侵入
- 13. boost smart_ptr非线程安全宏,它真的存在吗?
- 14. Spring mongoTemplate线程安全吗?
- 15. Lparallel.queue线程安全吗?
- 16. BoxClient线程安全吗?
- 17. EventHubClient.SendBatchAsync - 线程安全吗?
- 18. .NET:JsonMediaTypeFormatter线程安全吗?
- 19. multiset equal_range线程安全吗?
- 20. pip线程安全吗?
- 21. com.google.cloud.datastore.Datastore线程安全吗?
- 22. WNetGetResourceInformation线程安全吗?
- 23. qsort线程安全吗?
- 24. work_queue线程安全吗?
- 25. .NET DateTime线程安全吗
- 26. DynamoDBContext线程安全吗?
- 27. 在Python线程安全吗?
- 28. java.lang.reflect.Method线程安全吗?
- 29. HttpContext.Current.Cache线程安全吗?
- 30. UIFont线程安全吗?