sync.h  (sync.c)  is not a very good name, too specialized.   Why not   thread_utils.h  or concurrent.h  or something like this ?