Hello,

 

I have written a static library that uses boost program_options, threads, date-time and serialization libraries.  There is also an extensive use of shared_ptr.

I am working on a multithreaded application, so when I link my library into the executable, I use multithreaded versions of the boost libraries.  When I compile my library and application that links to it, I use –pthread flag in attempt to make it multi-threaded.

 

Everything compiles and links without a problem, however when I try to run the application, it hangs.  I have tried to bedug it and when I suspend a hanging thread it gives me following stack trace:

 

      18 _dl_sysinfo_int80()  0x003317a2 

      17 __lll_mutex_lock_wait()  0x0062e30e   

      16 _L_mutex_lock_35()  0x0062af3b  

      15 <symbol is not available> 0x080c80e8  

      14 <symbol is not available> 0x00472ff4  

      13 <symbol is not available> 0x080c80e8  

      12 <symbol is not available> 0xbffff6b0  

      11 <symbol is not available> 0xbffff208  

      10 pthread_mutex_lock()  0x0042097e

      9 pthread_mutex_lock()  0x0042097e 

      8 scoped_lock() /usr/include/boost/detail/lwm_pthreads.hpp:72 0x080598eb     

      7 boost::detail::sp_counted_base::add_ref_copy() /usr/include/boost/detail/shared_count.hpp:122 0x0805b679  

      6 shared_count() /usr/lib/boost/include/boost-1_34/boost/detail/shared_count.hpp:216 0x0805b65b 

      5 shared_ptr() /usr/include/c++/3.4.6/bits/stl_construct.h:81 0x0807a7c8     

      4 boost::program_options::options_description_easy_init::operator() libs/program_options/src/options_description.cpp:178 0xb7fd7189  

      3 Settings() ../Settings.cpp:9 0x08081808

 

If this post sounds familiar, that’s because this is my second attempt to get this problem resolved.

Previously I have been told that this sounds like I've built my application with single-threading, and linked it to multi-threaded build of a boost library, or vice versa.

Could you please let me know what’s the right way to build my app with multi-threading.

 

I am using Boost 1.34 libraries on Linux and compile with gcc 3.4.6

 

Thank you in advance for your help,

Inga