Hello all, Am 19.02.2015 um 21:22 schrieb Koen Deforche: > Hey, > > 2015-02-19 1:14 GMT+01:00 Joe VanAndel <vanan...@ucar.edu > <mailto:vanan...@ucar.edu>>: > > I’ve attached two of the races the helgrind detects. > wt_boost_race1 <http://pastebin.com/831vMuK5> > > > This one would suggest that boost::lexical_cast<> is not thread-safe > because of locale()? That can't be right?
>From my experience helgrind reports sometimes false positives. However I don't know the locale() code and if there are some global variables used this data race can happen. Note that there is no mutex used at all! Most likely these data races can be avoided if global data is initialized in the main thread before any other thread is started! Maybe call lexical_cast() in main() once? > The following race condition is quite interesting: > It appears that a http::server::TcpConnection object is being > destroyed as a result of a boost:shared_ptr() being destroyed, while > another thread is still using the TcpConnection object. > > Since boost::shared_ptr is supposed to be thread safe, it isn’t > obvious how this could happen. > > wt_boost_TcpConnec… <http://pastebin.com/zErMzYvL> > > > Also this does not make sense: shared_ptr guarantees that an object will > not be destroyed as other references exist? Helgrind data race reports should not be treat at the same time. The report should be interpreted that at some time memory at 0x51414C6 was read from thread #3 and at a later time memory at 0x51414C6 was written by thread #10 ***without using a mutex***!!! It does not say anything about lifetime of objects. However the write occurs within dtor thus any other thread does not 'see' this change in memory... So I would suppress this warning... Also interesting is that it occurs in code generated from the compiler!? I don't see any dtor within TcpConnection class!? Regards, Stefan ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest