线程绑定到指定CPU
时间:2021-06-21 20:34:49
收藏:0
阅读:0
参考:https://mp.weixin.qq.com/s/494wqyxyFzDuGwG_51tFbQ
<dependency>
<groupId>net.openhft</groupId>
<artifactId>affinity</artifactId>
<version>3.20.0</version>
</dependency>
public static void main(String[] args) {
try (AffinityLock affinityLock = AffinityLock.acquireLock(3)) {
// do some work while locked to a CPU.
while (true) {
}
}
}
评论(0)