<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>I try to use a <span class="Apple-style-span" style="color: rgb(63, 110, 116); font-family: Monaco; font-size: 12px; ">GiNaC</span><span class="Apple-style-span" style="color: rgb(63, 110, 116); font-family: Monaco; font-size: 12px; "><span style="color: #000000">::</span></span><span class="Apple-style-span" style="color: rgb(63, 110, 116); font-family: Monaco; font-size: 12px; ">symtab</span><span class="Apple-style-span" style="color: rgb(63, 110, 116); font-family: Monaco; font-size: 12px; "><span style="color: #000000"> in a thread object. I copy a const reference to the threaded method and get problems on reading the symbols.</span></span></div><div><span class="Apple-style-span" style="color: rgb(63, 110, 116); font-family: Monaco; font-size: 12px; "><span style="color: #000000">If I take a symbol from the table with </span></span><span class="Apple-style-span" style="font-family: Monaco; font-size: 12px; "><span style="color: #3f6e74">GiNaC</span>::ex x = m_symbols["mysymbol"], I would run on > 1 thread into errors. Valgrind shows this information:</span></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 12px; "><br></span></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 12px; "><div>Possible data race during write of size 4 at 0x1ea5c04 by thread #1</div><div><br></div><div>==38631== at 0x8137: std::_Rb_tree<std::string, std::pair<std::string const, GiNaC::ex>, std::_Select1st<std::pair<std::string const, GiNaC::ex> >, std::less<std::string>, std::allocator<std::pair<std::string const, GiNaC::ex> > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, GiNaC::ex> >*) (in main)</div><div><br></div><div>==38631== by 0x92BF: boost::_bi::storage1<boost::_bi::value<worker<double, 2ul> > >::~storage1() (in main)</div><div><br></div><div>==38631== by 0xE0B0: boost::thread* boost::thread_group::create_thread<boost::_bi::bind_t<void, boost::_mfi::mf0<void, worker<double, 2ul> >, boost::_bi::list1<boost::_bi::value<worker<double, 2ul> > > > >(boost::_bi::bind_t<void, boost::_mfi::mf0<void, worker<double, 2ul> >, boost::_bi::list1<boost::_bi::value<mworker<double, 2ul> > > >) (in main)</div><div><br></div><div>I have copied the table with </div><div><span class="Apple-style-span" style="color: rgb(0, 116, 0); ">std::copy( p_syms.begin(), p_syms.end(), std::inserter(m_symbols, m_symbols.begin()));</span></div><div><span class="Apple-style-span" style="color: rgb(0, 116, 0); "><br></span></div><div><span class="Apple-style-span" style="color: rgb(0, 116, 0); ">p_syms is the original table and m_symbols should be the copy, but it doesn't work. In my thread object I can use a deep copy of the symbol table, because every thread is independed of the other threads.</span></div><div><span class="Apple-style-span" style="color: rgb(0, 116, 0); "><br></span></div><div><span class="Apple-style-span" style="color: rgb(0, 116, 0); ">I'm not sure that the problem is a GiNaC problem, but you can give some tips perhaps.</span></div><div><span class="Apple-style-span" style="color: rgb(0, 116, 0); "><br></span></div><div><span class="Apple-style-span" style="color: rgb(0, 116, 0); ">Thanks</span></div><div><span class="Apple-style-span" style="color: rgb(0, 116, 0); "><br></span></div><div><span class="Apple-style-span" style="color: rgb(0, 116, 0); ">Phil</span></div></span></div></body></html>