Why doesn't multithreading in C# reach 100% CPU?

前端 未结 13 1355
眼角桃花
眼角桃花 2021-01-30 22:17

I\'m working on a program that processes many requests, none of them reaching more than 50% of CPU (currently I\'m working on a dual core). So I created a threa

13条回答
  •  星月不相逢
    2021-01-30 22:46

    I think I had a similar problem. I was creating multiple threads in c# that ran c++ code through a COM interface. My dual core CPU never reached 100%.

    After reading this post, I almost gave up. Then I tried calling SetApartmentState(ApartmentState.STA) on my Threads.

    After only changing this, the CPU maxed out.

提交回复
热议问题