Boost C++ Libraries: Ticket #1328: boost::spirit concurrency gap https://svn.boost.org/trac10/ticket/1328 <p> The following snipped code from the "boost::spirit" library contains the problem with concurrent access to a static object. Creation of a object of "thread_specific_ptr" type should be protected while concurrent access is performed. </p> <p> <em>boost\spirit\core\non_terminal\impl\grammar.ipp </em></p> <p> ... </p> <p> # ifdef BOOST_SPIRIT_THREADSAFE </p> <blockquote> <p> <em>should be protected with a "call once" idiom </em></p> </blockquote> <blockquote> <p> static boost::thread_specific_ptr&lt;ptr_t&gt; tld_helper; </p> </blockquote> <blockquote> <p> if (!tld_helper.get()) </p> </blockquote> <blockquote> <blockquote> <p> tld_helper.reset(new ptr_t); </p> </blockquote> </blockquote> <blockquote> <p> ptr_t &amp;helper = *tld_helper; </p> </blockquote> <p> # else </p> <blockquote> <p> static ptr_t helper; </p> </blockquote> <p> # endif </p> <p> ... </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1328 Trac 1.4.3 anonymous Mon, 05 Nov 2007 01:13:21 GMT <link>https://svn.boost.org/trac10/ticket/1328#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1328#comment:1</guid> <description> <p> Fix applied. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Mon, 05 Nov 2007 15:41:32 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/1328#comment:2 https://svn.boost.org/trac10/ticket/1328#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket