Windows 线程:beginthread 或 QueueUserWorkItem (C++)
我想知道是否对 C++ 中的线程方法使用 beginthread 或 QueueUserWorkItem 。这两个 API 之间有什么区别?它们更适合什么环境?
谢谢,
顺便说一句,我已经读过这个问题 Windows 线程:_beginthread vs _beginthreadex vs创建线程 C++
I am wondering whether to use beginthread or QueueUserWorkItem for threaded methods in C++. What are the differences between the two APIs and in what context are they better suited?
Thanks,
BTW, I have read this question Windows threading: _beginthread vs _beginthreadex vs CreateThread C++
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
QUWI使用线程池中的线程来执行回调函数。此类线程重量非常轻,但并不适合所有类型的线程任务。基本要求是它们的生命周期相对较短,不会经常阻塞并且对时间要求不高。
SDK 主题。
QUWI uses a thread from the thread pool to execute the callback function. Such threads are very light weight but not suitable for all types of threaded tasks. Basic requirements are that they need to be relatively short-lived, don't block very often and are not time critical.
It is all rather well explained in the SDK topic.
该系统在管理线程方面比应用程序做得更好。只需使用系统线程池即可完成。
The system does a better job at managing threads than an app. Just use the system thread pool and be done with it.