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


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

Re: mutexes try_lock noexcept issue

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail
From Pete Becker<pete@versatilecoding.com>
Newsgroups comp.std.c++
Subject Re: mutexes try_lock noexcept issue
Date Tue, 3 Jan 2012 13:01:30 -0800 (PST)
Organization Roundhouse Consulting, Ltd.
Lines 31
Sender std-cpp-request@vandevoorde.com
Approved stephen.clamage@oracle.com
Message-ID <2012010311540476770-pete@versatilecodingcom> (permalink)
References <cf2b78da-6d9e-4163-bb7e-de5b74abbeca@m10g2000vbc.googlegroups.com>
NNTP-Posting-Host 2oZfvE7CbglWnqzMP4tqGpEk5dfiTflRtKmYLS5y1AA=
Content-Type text/plain; charset=iso-8859-1; format=flowed
X-Trace news.albasani.net C+QMJj+t5IrC4Y+LbNLWP5cOqTFtrhXBHI0+hRIHcYJWZQVthzaEk9HkizEb+DGMQwuKUevbOQCL/81wFXMYbQ==
X-Complaints-To abuse@albasani.net
NNTP-Posting-Date Tue, 3 Jan 2012 21:06:56 +0000 (UTC)
X-Mailer Perl5 Mail::Internet v2.05
X-Submission-Address std-cpp-submit@vandevoorde.com
Cancel-Lock sha1:orhV+ayjhkaPH4l7sRiZaQJesAI=
X-Original-Date Tue, 3 Jan 2012 11:54:04 -0500
Xref x330-a1.tempe.blueboxinc.net comp.std.c++:404

Show key headers only | 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