The problem with pthread_self() is that the value it returns is defined to
be "opaque", and isn't necessarily (e.g.) and unsigned long (32 bit), though
many Unix and Unix like systems do use a 32 bit value ...
> http://www.openssl.org/docs/crypto/threads.html says
> "id_function(void) is a function that returns a thread ID. It is not
> needed on Windows nor on platforms where getpid() returns a different
> ID for each thread (most notably Linux)."
> On my Linux system, getpid() returns the same pid for each thread.
> I'm told that this is the correct Posix behavior, although a Google
> search showed that early Linux did not do that.
How about the replacement text
"id_function(void) is a function that returns a thread ID, for instance,
pthread_self(). It is not, needed on Windows nor on platforms where getpid()
returns a different ID for each thread. However, even on those platforms,
pthread_self() should be used, since the behavior of getpid() may depend
on the machine where the program is being run, not the machine where
the program is being compiled.
(For instance, Red Hat 8 Linux and earlier
used LinuxThreads, whose getpid() returns a different value for each thread;
Red Hat 9 Linux and later use NPTL, which is Posix-conformant, and thus
whose getpid() returns the same value for each thread in a process.
But a program compiled on Red Hat 8 and run on Red Hat 9 will
by default see getpid() returning the same value for all threads.)
Or something shorter but still as enlightening :-)