是否有任何对 C++ 很重要的常见设计模式或常见习惯用法? win32多线程编程?

发布于 2024-07-15 12:20:35 字数 69 浏览 6 评论 0原文

一个例子是: RAII - 资源获取是与关键部分一起使用的初始化

还有其他重要的、流行的并且您经常使用的吗?

One example could be: RAII - Resource Acquisition is Initialization used with critical sections

Any others that are important, popular and you often use?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

愿得七秒忆 2024-07-22 12:20:35

此链接提到了很多。 命令模式可以方便地将请求分派给线程。 领导者/追随者似乎也是一个有趣的模式。

This link mentions quite a few. The Command pattern comes in handy for dispatching requests to threads. Leader/Followers seems to be an interesting pattern as well.

别靠近我心 2024-07-22 12:20:35

您也可以尝试以下方法:模式和习惯用法

You can try this also: patterns and idioms

别念他 2024-07-22 12:20:35

对于我当前的产品和高性能桌面应用程序,我使用消息传递,不共享并发过去曾写过。 根据我的经验,最好避免共享数据同步。 您可以使用NamedPipes、窗口消息或套接字在线程之间进行通信。

如果您确实决定尝试同步对共享数据的访问,看看这个主题。

I use message passing, share nothing concurrency both for my current product and for high performance desktop applications I have written in the past. In my experience, its better to avoid shared data synchronization. You can use NamedPipes, window messages or sockets to communicate between threads.

If you do decide to try and syncronize access to shared data, take a look at this topic.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文