regex icu library (thread safety)
I need to build boost regex library with ICU support. I followed instruction in: http://www.boost.org/doc/libs/1_46_1/libs/regex/doc/html/boost_regex/install... First I downloaded ICU library and compiled it without any problem. Then I ran the following command: cd /opt/third_party_libraries/boost_1_46_1/libs/regex/build/ (Boost source code is in "/opt/third_party_libraries/boost_1_46_1") [root@pli-dc-build build]# /opt/third_party_libraries/boost_1_46_1/bjam include=/usr/local/ --toolset=gcc install Performing configuration checks - has_icu builds : yes ...patience... ... ... gcc.compile.c++ ../../../bin.v2/libs/regex/build/gcc-3.4.6/debug/usinstances.o gcc.link.dll ../../../bin.v2/libs/regex/build/gcc-3.4.6/debug/libboost_regex.so.1.46.1 common.copy /opt/third_party_libraries/boost_1_46_1/lib/libboost_regex.so.1.46.1 ln-UNIX /opt/third_party_libraries/boost_1_46_1/lib/libboost_regex.so ln-UNIX /opt/third_party_libraries/boost_1_46_1/lib/libboost_regex.so.1 ln-UNIX /opt/third_party_libraries/boost_1_46_1/lib/libboost_regex.so.1.46 ...updated 22 targets... The build process is successful and I can find the library in "/opt/third_party_libraries/boost_1_46_1/lib/libboost_regex.so.1.46.1". The question is: does this library support multiple threads? I did some research on this topic, it seems like even though the name does not contain "mt", it is actually thread safe. Or do I have to pass extra parameter to generate thread safe version? The normal boost build process generates regex library with name like: libboost_regex-gcc34-mt-1_46_1.so.1.46.1 (http://www.boost.org/doc/libs/1_46_1/more/getting_started/unix-variants.html) From the name, I know if the library supports multiple threads. My development box: uname -a Linux 2.6.18-308.1.1.el5PAE #1 SMP Wed Mar 7 04:57:46 EST 2012 i686 i686 i386 GNU/Linux gcc --version gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-4.1) Copyright (C) 2006 Free Software Foundation, Inc. Thanks
The build process is successful and I can find the library in "/opt/third_party_libraries/boost_1_46_1/lib/libboost_regex.so.1.46.1".
The question is: does this library support multiple threads? I did some research on this topic, it seems like even though the name does not contain "mt", it is actually thread safe. Or do I have to pass extra parameter to generate thread safe version?
Yes it's thread safe as long as GCC and libstdc++ are (which they should be
on your platform). At some point Boost.Build reduced the number of build
variants on Linux so we basically only build thread safe release versions.
HTH, John.
PS You can always check this in your code with a:
#include
participants (2)
-
John Maddock
-
PingShan Li