对于-lpthread 我在《Using the GNU Compiler Collection》gcc 4.30 中关于-lpthread的描述如下:
-pthread Add support for multithreading using the POSIX threads library. This option sets flags for both the preprocessor and linker. It does not affect the thread safety of object code produced by the compiler or that of libraries supplied with it. These are HP-UX specific flags.