如何在线程之间对应
今天,我被教导使用STD :: Future and Promise和Promise在C ++ 11线程中。我了解到它们可用于线程之间的对应关系。但是,当我尝试一下时,这个想法告诉我,“ get_future”功能只能使用一次。此外,函数“ std :: future”是相同的。那么,我该如何正确使用两者之间建造两个线程之间的桥梁,并让它们互相交流多次呢?非常感谢您回答我的问题。
Today I am taught to use std::future and promise in c++11 thread. I learnt that they can be used for correspondence between threads. But when I have a try on them, the IDEA told me that the function 'get_future' can be used only one time. Besides, the function 'std::future' is just the same. So how can I use the two correctly to build a bridge between two threads and let them communicate with each other more than one time? Thank you very much for answering my question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论