how to run each thread on other core?

后端 未结 3 1495
后悔当初
后悔当初 2021-01-23 13:10

I have a udp server that receive data and computing it.

I have two thread for each role.

In my cpu is a 8 multi-core and I send data in varius speed.

but

3条回答
  •  醉梦人生
    2021-01-23 14:13

    In each thread you can use SetThreadAffinityMask to choose CPUs that your thread should run on it. But I suggest you create a new worker thread for each incoming request (also if you use a thread pool you see considerable performance boost)

提交回复
热议问题