Boost C++ Libraries: Ticket #8530: [Coverity] Unused variable thread_handle, uninitialized variable cond_mutex in thread/pthread/thread_data.hpp https://svn.boost.org/trac10/ticket/8530 <p> This was found in an older release, but is still present in trunk. </p> <p> Coverity complains </p> <pre class="wiki">134 thread_data_base(): 135 done(false),join_started(false),joined(false), 136 thread_exit_callbacks(0), 137 current_cond(0), 138 notify(), 139 async_states_() 140 //#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS 141 , interrupt_enabled(true) 142 , interrupt_requested(false) 143 //#endif </pre><blockquote> <p> (2) Event uninit_member: Non-static class member "thread_handle" is not initialized in this constructor nor in any functions </p> <blockquote> <p> that it calls. </p> </blockquote> <p> (4) Event uninit_member: Non-static class member "cond_mutex" is not initialized in this constructor nor in any functions </p> <blockquote> <p> that it calls. </p> </blockquote> </blockquote> <p> Initializing the two fields to zero seems reasonable, and makes coverity happy. </p> <p> To repeat (assuming you have a coverity license, and bjam in $HOME/local/bin): </p> <p> PATH=/opt/coverity/cov-analysis-linux64-6.5.1/bin:$HOME/local/bin:$PATH cov-configure --gcc rm -rf covlog mkdir -p covlog cov-build --dir covlog bjam t_threads cov-analyze --dir covlog cov-format-errors --dir covlog find covlog -type f | xargs grep cond_mutex.*not.*init find covlog -type f | xargs grep thread_handle.*not.*init </p> <p> If grep finds anything, you've got the problem. </p> <p> The attached patch makes the greps not find anything. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8530 Trac 1.4.3 Dan Kegel <dank@…> Tue, 30 Apr 2013 23:26:47 GMT attachment set https://svn.boost.org/trac10/ticket/8530 https://svn.boost.org/trac10/ticket/8530 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-pthread-data.patch</span> </li> </ul> <p> Draft patch to initialize the affected member variables </p> Ticket Dan Kegel <dank@…> Tue, 30 Apr 2013 23:28:23 GMT <link>https://svn.boost.org/trac10/ticket/8530#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8530#comment:1</guid> <description> <p> Sorry about the formatting. There are a lot of line breaks missing. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 01 May 2013 06:48:48 GMT</pubDate> <title>description changed https://svn.boost.org/trac10/ticket/8530#comment:2 https://svn.boost.org/trac10/ticket/8530#comment:2 <ul> <li><strong>description</strong> modified (<a href="/trac10/ticket/8530?action=diff&amp;version=2">diff</a>) </li> </ul> Ticket viboes Wed, 01 May 2013 06:55:03 GMT owner, status changed https://svn.boost.org/trac10/ticket/8530#comment:3 https://svn.boost.org/trac10/ticket/8530#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket viboes Wed, 01 May 2013 08:19:09 GMT milestone changed https://svn.boost.org/trac10/ticket/8530#comment:4 https://svn.boost.org/trac10/ticket/8530#comment:4 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.54.0</span> </li> </ul> <p> Committed revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/84096" title="Thread: apply patch for #8530.">[84096]</a>. </p> Ticket viboes Wed, 01 May 2013 16:45:51 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8530#comment:5 https://svn.boost.org/trac10/ticket/8530#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Merged from trunk <a class="changeset" href="https://svn.boost.org/trac10/changeset/84101" title="Thread: merge latch; invoke.">[84101]</a>. </p> Ticket