setpgid(child) fails if the child was forked by sub-thread