gpt4 book ai didi

c# - 如何告诉线程池在 `STA` 线程上运行委托(delegate)?

转载 作者:太空狗 更新时间:2023-10-29 20:25:41 25 4
gpt4 key购买 nike

我需要一个线程池来处理 ASP.NET 项目中的 COM 对象。

QueueUserWorkItemSTA(WaitCallback)

最佳答案

来自 Smart Thread Pool 的 CodeProject 文章:

Also note that the .NET ThreadPool doesn't support calls to COM with single threaded apartment (STA), since the ThreadPool threads are MTA by design.

所以我假设如果您尝试使用智能线程池,它会满足您的要求。

就我个人而言,多年来我一直在成功地使用这个类(class)。

关于c# - 如何告诉线程池在 `STA` 线程上运行委托(delegate)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4528261/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com