[GiNaC-list] symtab problem with multithread

Kraus Philipp philipp.kraus at flashpixx.de
Fri Aug 20 20:07:37 CEST 2010


I try to use a GiNaC::symtab in a thread object. I copy a const  
reference to the threaded method and get problems on reading the  
If I take a symbol from the table with GiNaC::ex x =  
m_symbols["mysymbol"], I would run on > 1 thread into errors. Valgrind  
shows this information:

Possible data race during write of size 4 at 0x1ea5c04 by thread #1

==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)

==38631==    by 0x92BF:  
boost::_bi::storage1<boost::_bi::value<worker<double, 2ul> >  
 >::~storage1() (in main)

==38631==    by 0xE0B0: boost::thread*  
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)

I have copied the table with
std::copy( p_syms.begin(),       p_syms.end(),        
std::inserter(m_symbols, m_symbols.begin()));

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.

I'm not sure that the problem is a GiNaC problem, but you can give  
some tips perhaps.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20100820/f1078ab9/attachment.html>

More information about the GiNaC-list mailing list