This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] proposed fix for libstdc++/54352


On 16 June 2013 15:35, Jonathan Wakely wrote:
> In order to conform to  [thread.condition.condvarany]/5 and fix this
> PR we need an ABI change to std::condition_variable_any, so that its
> internal mutex can outlive the condition_variable_any while there are
> threads blocked on the mutex, which this patch does by using a
> shared_ptr to hold the mutex and making waiting threads share
> ownership of that mutex.
>
> The ABI change is handled similarly to the recent chrono::steady_clock
> changes, using an inline namespace for the new versions and continuing
> to export the old version from the library for compatibility with old
> code.
>
> Any thoughts or suggestions on improving this before I commit it to trunk?
>
> I can no longer reproduce the valgrind errors, except by hacking in
> changes to std::mutex to cause races, so I haven't been able to write
> a test case that fails without this change, but I believe it's still
> necessary for correctness.
>
>         PR libstdc++/54352
>         * include/std/condition_variable (condition_variable_any): Move into
>         inline namespace _V2 and replace mutex member with shared_ptr<mutex>.
>         * src/c++11/condition_variable.cc (condition_variable_any): Move
>         definitions to ...
>         * src/c++11/compatibility-condvar.cc (condition_variable_any): Here.
>         * src/Makefile.am: Add new source file.
>         * src/Makefile.in: Regenerate.

I've just committed this to trunk.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]