Oops, forgot : and you should always compile your programs with -DREENTRANT (or add #define REENTRANT), at least that's how it used to be, it is not in the man page (anymore?). Maybe, gcc is now configured to recognize -lpthread and automatically emit REENTRANT save code...
Guy