On Jun 18, 9:15 pm, Francis Litterio <[EMAIL PROTECTED]> wrote: > mathieu wrote: > > I am currently having some very random seg faults. The few times > > where it seg fault this is somewhere during a read access to a > > std::map. Those accesses are concurrent (SMP machine). Is there > > something I need to do even for read only access ? > > I assume that _something_ writes to the memory that is being read. > Given that, you'll need to synchronize all the readers and writers using > a mutex.
Hi Fran, I was not searching at the right spot. The fact the result from a find in a std::map was trashed was (I believe) because initilization was done too late (from a thread). I'll try to initialize the map earlier. Thanks -Mathieu Just for reference, here was the backtrace that lead me to believe std::map was not thread safe: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x40804950 (LWP 8374)] 0x00002b78be3fd104 in std::_Rb_tree_rotate_left () from /usr/lib/ libstdc++.so.6 (gdb) bt #0 0x00002b78be3fd104 in std::_Rb_tree_rotate_left () from /usr/lib/ libstdc++.so.6 #1 0x00002b78be3fd28c in std::_Rb_tree_insert_and_rebalance () from / usr/lib/libstdc++.so.6 #2 0x00002b78ba63b9ce in std::_Rb_tree<gdcm::Tag, std::pair<gdcm::Tag const, gdcm::DictEntry>, std::_Select1st<std::pair<gdcm::Tag const, gdcm::DictEntry> >, std::less<gdcm::Tag>, std::allocator<std::pair<gdcm::Tag const, gdcm::DictEntry> > >::_M_insert (this=0x646c90, __x=0x0, __p=0x2aaab802df40, [EMAIL PROTECTED]) at /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../ include/c++/4.1.2/bits/stl_tree.h:821 #3 0x00002b78ba63bbb1 in std::_Rb_tree<gdcm::Tag, std::pair<gdcm::Tag const, gdcm::DictEntry>, std::_Select1st<std::pair<gdcm::Tag const, gdcm::DictEntry> >, std::less<gdcm::Tag>, std::allocator<std::pair<gdcm::Tag const, gdcm::DictEntry> > >::insert_unique (this=0x646c90, [EMAIL PROTECTED]) at /usr/lib/gcc/ x86_64-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h: 931 #4 0x00002b78ba63bc3f in std::map<gdcm::Tag, gdcm::DictEntry, std::less<gdcm::Tag>, std::allocator<std::pair<gdcm::Tag const, gdcm::DictEntry> > >::insert (this=0x646c90, [EMAIL PROTECTED]) at /usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../include/c++/ 4.1.2/bits/stl_map.h:396 #5 0x00002b78ba63bca3 in gdcm::Dict::AddDictEntry (this=0x646c90, [EMAIL PROTECTED], [EMAIL PROTECTED]) at /home/mmalaterre/Projects/gdcm/ branches/gdcm-2-0/Source/DataDictionary/gdcmDict.h:69 _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus