Switch threading from using linux tids (change after fork) to pthread_t (same after fork)

Should also reduce our Linux-dependence