I\'m trying to set the CPU affinity of threads on Linux. I\'d like to know which one of the following approaches is recommended:
Get thread
I believe the fact that gettid() exists only as a system call and hasn't been exposed directly as an API call could mean "use it only if you're absolutely certain of what you're doing" and gettid() is not meant to be portable.
You should be better if you stick to pthread. You can change scheduling policy/priority later with pthread_setschedparam()