GCC (libstdc++) 付属の STL をマルチスレッド環境で使うにはどういう設定が要るんでしょうか?という基本的な疑問

あったあった.


When you link a multithreaded application, you will probably need to add a library or flag to g++. This is a very non-standardized area of GCC across ports. Some ports support a special flag (the spelling isn't even standardized yet) to add all required macros to a compilation (if any such flags are required then you must provide the flag for all compilations not just linking) and link-library additions and/or replacements at link time. The documentation is weak. Here is a quick summary to display how ad hoc this is: On Solaris, both -pthreads and -threads (with subtly different meanings) are honored. On OSF, -pthread and -threads (with subtly different meanings) are honored. On Linux/i386, -pthread is honored. On FreeBSD, -pthread is honored. Some other ports use other switches. AFAIK, none of this is properly documented anywhere other than in ``gcc -dumpspecs'' (look at lib and cpp entries).
上にプラスしてこれか.

However, please ignore all discussions about the user-level configuration of the lock implementation inside the STL container-memory allocator on those pages. For the sake of this discussion, libstdc++-v3 configures the SGI STL implementation, not you. This is quite different from how gcc pre-3.0 worked. In particular, past advice was for people using g++ to explicitly define _PTHREADS or other macros or port-specific compilation options on the command line to get a thread-safe STL. This is no longer required for any port and should no longer be done unless you really know what you are doing and assume all responsibility.
GCC 3.0 以降の場合「_PTHREADS define しろ」とかいうアドバイスは古い,と.
あと, SGI の実装なので当然これこれ (前者は以前,どなたかにコメントで教えていただいたことがあるはず).
やはりさすがに自分がお世話になっている環境のドキュメントぐらいは読み込んでおかないとダメカナ?