LevelDB project 1 10225501460 林子骥 10211900416 郭夏辉
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
389 B

1 개월 전
  1. #include <pthread.h>
  2. int main() {
  3. cpu_set_t set;
  4. CPU_ZERO(&set);
  5. for (int i = 0; i < CPU_SETSIZE; ++i) {
  6. CPU_SET(i, &set);
  7. CPU_CLR(i, &set);
  8. }
  9. pthread_t self = pthread_self();
  10. int ret;
  11. ret = pthread_getaffinity_np(self, sizeof(set), &set);
  12. if (ret != 0) return ret;
  13. ret = pthread_setaffinity_np(self, sizeof(set), &set);
  14. if (ret != 0) return ret;
  15. return 0;
  16. }