How to tell thread-pool to run a delegate on a `STA` thread?

本秂侑毒 提交于 2019-12-12 10:37:21

问题


I need a thread-pool for working with COM objects inside an ASP.NET project.

QueueUserWorkItemSTA(WaitCallback)

回答1:


From the CodeProject Article of Smart Thread Pool:

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.

So I assume if you give the Smart Thread Pool a try, it could fit your requirements.

Personally, I use this class successfully since severals years.



来源:https://stackoverflow.com/questions/4528261/how-to-tell-thread-pool-to-run-a-delegate-on-a-sta-thread

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!