Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #404

Re: mutexes try_lock noexcept issue

From Pete Becker<pete@versatilecoding.com>
Newsgroups comp.std.c++
Subject Re: mutexes try_lock noexcept issue
Date 2012-01-03 13:01 -0800
Organization Roundhouse Consulting, Ltd.
Message-ID <2012010311540476770-pete@versatilecodingcom> (permalink)
References <cf2b78da-6d9e-4163-bb7e-de5b74abbeca@m10g2000vbc.googlegroups.com>

Show all headers | View raw


On 2012-01-01 22:26:47 +0000, viboes said:

>  In 30.4.1.2.2	Class recursive_mutex	[thread.mutex.recursive]
>
>  try_lock is declared as noexcept
>
>     bool try_lock() noexcept;
>
>  but 30.4.1.2.1	Class mutex declare it without noexcept
>     bool try_lock();
>
>  The same applies for timed_mutex and recursive_timed_mutex.
>
>  Shouldn't both be coherent. When could try_lock throw an exception?
>

If the mutex is already owned by the calling thread, the behavior of a
call to try_lock() is undefined. One possibility is to throw an
exception. For a recursive mutex, the behavior is well defined.

-- 
  Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)


[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

mutexes try_lock noexcept issue viboes<vicente.botet@wanadoo.fr> - 2012-01-01 14:26 -0800
  Re: mutexes try_lock noexcept issue Pete Becker<pete@versatilecoding.com> - 2012-01-03 13:01 -0800
    Re: mutexes try_lock noexcept issue Alexander Terekhov<terekhov@web.de> - 2012-01-11 09:58 -0800
      Re: mutexes try_lock noexcept issue Daniel Krügler<daniel.kruegler@googlemail.com> - 2012-01-14 17:16 -0800

csiph-web