Dunno whether this ought to be in the *ix room or in the programming room,
but whatever...
Today I came to the realization that ever since NPTL was merged into glibc some ~20 years ago, it's no longer necessary to specify "-lpthread" when compiling a multithreaded program. I tried it and it worked fine. I looked at the library on disk and, sure enough, it's just a null library that is only there to keep build scripts from breaking.
I was about to remove "-lpthread" from my published Makefiles but then I stopped to consider, it might still be required on non-Linux systems. FreeBSD in particular looks like it has several different implementations of POSIX Threads to choose from (why?) and you have to specify "-lpthread" to make it link that one, or you can specify one of several others.
Am I correct about that? If you try to use POSIX Threads library calls on BSD and don't link a threading library, will it fail to link?
Today I came to the realization that ever since NPTL was merged into glibc some ~20 years ago, it's no longer necessary to specify "-lpthread" when compiling a multithreaded program. I tried it and it worked fine. I looked at the library on disk and, sure enough, it's just a null library that is only there to keep build scripts from breaking.
I was about to remove "-lpthread" from my published Makefiles but then I stopped to consider, it might still be required on non-Linux systems. FreeBSD in particular looks like it has several different implementations of POSIX Threads to choose from (why?) and you have to specify "-lpthread" to make it link that one, or you can specify one of several others.
Am I correct about that? If you try to use POSIX Threads library calls on BSD and don't link a threading library, will it fail to link?