Boost C++ Libraries: Ticket #3269: boost thread - mutex.lock() doesn't throw exception https://svn.boost.org/trac10/ticket/3269 <p> lock() member function of mutex object doesn't throw any exception on error. There is no error handling capabilities because lock() doesn't return any value. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3269 Trac 1.4.3 talanchor@… Thu, 16 Jul 2009 13:30:18 GMT component changed; owner set https://svn.boost.org/trac10/ticket/3269#comment:1 https://svn.boost.org/trac10/ticket/3269#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Anthony Williams</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">thread</span> </li> </ul> Ticket Steven Watanabe Fri, 21 Aug 2009 14:09:45 GMT <link>https://svn.boost.org/trac10/ticket/3269#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3269#comment:2</guid> <description> <p> What errors do you expect from pthread_mutex_lock? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 31 Aug 2009 12:50:11 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3269#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3269#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/3269#comment:2" title="Comment 2">steven_watanabe</a>: </p> <blockquote class="citation"> <p> What errors do you expect from pthread_mutex_lock? </p> </blockquote> <p> mutex.lock() call may fail - and it sometimes does (according, for example, to POSIX mutexes), so we need to know that something went wrong. One way to report an error is to throw system_error exception, like for example just::thread library does: <a class="ext-link" href="http://www.stdthread.co.uk/doc/headers/mutex/mutex/lock.html"><span class="icon">​</span>http://www.stdthread.co.uk/doc/headers/mutex/mutex/lock.html</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Mon, 31 Aug 2009 15:22:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3269#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3269#comment:4</guid> <description> <p> Well, it doesn't fail randomly. Most of the possible failures either cannot happen with boost::mutex or are a result of undefined behavior. However, EAGAIN and ENOMEM appear to be possible. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 04 Sep 2009 14:07:54 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3269#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3269#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/3269#comment:4" title="Comment 4">steven_watanabe</a>: </p> <blockquote class="citation"> <p> Well, it doesn't fail randomly. Most of the possible failures either cannot happen with boost::mutex or are a result of undefined behavior. However, EAGAIN and ENOMEM appear to be possible. </p> </blockquote> <p> On QNX pthread_mutex_lock may also return EDEADLK - if mutex was not set as recursive, or ETIMEDOUT if "A kernel timeout unblocked the call", and all this return values including EAGAIN are possible. At least this errors should be logged somewhere and execution of the thread should be cancelled. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Fri, 04 Sep 2009 14:44:09 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3269#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3269#comment:6</guid> <description> <p> Relocking a mutex that is already locked by the current thread is undefined behavior, so EDEADLK is irrelevant. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 13 Oct 2009 13:20:39 GMT</pubDate> <title>version, milestone changed https://svn.boost.org/trac10/ticket/3269#comment:7 https://svn.boost.org/trac10/ticket/3269#comment:7 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.39.0</span> → <span class="trac-field-new">Boost 1.40.0</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.40.0</span> → <span class="trac-field-new">Boost 1.41.0</span> </li> </ul> Ticket anonymous Tue, 09 Mar 2010 13:15:25 GMT version, milestone changed https://svn.boost.org/trac10/ticket/3269#comment:8 https://svn.boost.org/trac10/ticket/3269#comment:8 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.40.0</span> → <span class="trac-field-new">Boost 1.43.0</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.41.0</span> → <span class="trac-field-new">Boost 1.43.0</span> </li> </ul> Ticket viboes Fri, 21 May 2010 15:34:21 GMT <link>https://svn.boost.org/trac10/ticket/3269#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3269#comment:9</guid> <description> <p> I propose to resolve as invalid as works as designed. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Anthony Williams</dc:creator> <pubDate>Fri, 21 May 2010 17:14:25 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3269#comment:10 https://svn.boost.org/trac10/ticket/3269#comment:10 <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> <p> Fixed on trunk </p> Ticket