This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] mutex, condition_variable
- From: "Andrew Pinski" <pinskia at gmail dot com>
- To: "Benjamin Kosnik" <bkoz at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 7 May 2008 03:12:11 -0700
- Subject: Re: [v3] mutex, condition_variable
- References: <20080506162205.594406fa@wabash.artheist.org>
On Tue, May 6, 2008 at 2:22 PM, Benjamin Kosnik <bkoz@redhat.com> wrote:
>
> This adds in preliminary support for C++0x mutex/condition_variable, as
> first posted here:
> http://gcc.gnu.org/ml/libstdc++/2008-03/msg00059.html
>
> Large parts of mutex are taken from the existing support in
> ext/concurrence.h, which explains the copyright dates on that file.
30_threads/mutex/try_lock/2.cc fails on darwin because try_lock
throws an exception.
pthread_mutex_trylock returns EBUSY which is correct as the mutex is
already locked. I have not looked into what the C++0x standard says
though about what happens when try_lock fails because it is already
locked but the POSIX standard is clear what the behavior of
pthread_mutex_trylock is here.
The pthread_mutex_trylock() function shall fail if:
[EBUSY]
The mutex could not be acquired because it was already locked.
I think GNU/Linux is not returning the correct value here as far as I
can tell from reading the POSIX standard.
Thanks,
Andrew Pinski