Added some thread utils to be able to set thread affinity - only works for the pthread api for now.