Boost C++ Libraries: Ticket #6200: patch to have condition_variable and mutex error better handle EINTR https://svn.boost.org/trac10/ticket/6200 <p> On some flavors of Linux, for some versions of the pthread library, there are cases where it erroneously sends EINTR. This is a violation of POSIX, but it exists on some customer's production machines. </p> <p> BOOST_VERIFY aborts on EINTR, but EINTR is usually not fatal, it just means you need to try later. Being that this behavior was found in production, I believe that it would be valuable to have Boost help protect downstream consumers from bad threading library behavior. This allows downstream consumers of Boost to not need to continuously rediscover and re-patch for this same bug. </p> <p> So, with this in mind, attached is a proposed patch to allow condition_variable and mutex to better handle interacting with this potentially broken threading library behavior. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6200 Trac 1.4.3 blentz@… Fri, 02 Dec 2011 15:49:54 GMT attachment set https://svn.boost.org/trac10/ticket/6200 https://svn.boost.org/trac10/ticket/6200 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">thread_eintr.patch</span> </li> </ul> <p> patch to correct for receiving EINTR in condition_variable and mutex. </p> Ticket viboes Fri, 02 Dec 2011 20:19:59 GMT keywords, status, owner changed; cc set https://svn.boost.org/trac10/ticket/6200#comment:1 https://svn.boost.org/trac10/ticket/6200#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">viboes</span> added </li> <li><strong>keywords</strong> 1.49 added </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> </ul> <p> This part is not correct </p> <pre class="wiki"> 55 res=pthread_cond_wait(&amp;cond,&amp;internal_mutex); 55 int ret; 56 do { 57 ret = pthread_cond_wait(&amp;cond,m.mutex()-&gt;native_handle()); 58 } while (ret == EINTR); </pre><p> Note that before the mutex used was internal_mutex. Are you sure that this patch is working for your applications? </p> Ticket viboes Sat, 03 Dec 2011 10:10:46 GMT milestone changed https://svn.boost.org/trac10/ticket/6200#comment:2 https://svn.boost.org/trac10/ticket/6200#comment:2 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.49.0</span> </li> </ul> <p> Committed in trunk revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/75781" title="Thread: 6200 patch to have condition_variable and mutex error better ...">[75781]</a> condition variable part. </p> Ticket blentz@… Mon, 05 Dec 2011 15:11:28 GMT <link>https://svn.boost.org/trac10/ticket/6200#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6200#comment:3</guid> <description> <p> It looks like only the condition_variable and condition_variable_fwd portion of the patch was committed. </p> <p> The changes to mutex are missing in revision 75781. </p> <p> Was this done by choice or is it an oversight? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 07 Dec 2011 23:16:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6200#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6200#comment:4</guid> <description> <p> Committed in trunk revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/75882" title="Thread: #6200-mutex error better handle EINTR">[75882]</a> mutex part </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 07 Jan 2012 22:56:22 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6200#comment:5 https://svn.boost.org/trac10/ticket/6200#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> Committed in release at <a class="changeset" href="https://svn.boost.org/trac10/changeset/76291" title="Thread fixed Bugs: * [@http://svn.boost.org/trac/boost/ticket/2309 ...">[76291]</a> </p> Ticket