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: [v3] fix PR 54297 - segfaults with std::async


On 26 August 2012 00:02, Jonathan Wakely wrote:
> This fixes a stupid mistake I made where the functor and asynchronous
> result can go out of scope before the async thread is joined.
>
> The _Async_state_common destructor still needs to be exported from the
> library, which is what the macro hack is for.
>
>         PR libstdc++/54297
>         * include/std/future (~_Async_state_impl): Join thread before
>         derived class members are destroyed.
>         (~_Async_state_common): Only define non-trivial destructor when
>         included from future.cc for ABI compatibility reasons.
>         * src/c++11/future.cc (_GLIBCXX_ABI_COMPAT_ASYNC): Define.
>         * testsuite/30_threads/async/54297.cc: New.
>
> Tested x86_64-linux, committed to trunk and 4.7

I realised the compatibility symbols should be in one of the files
used for that purpose, so this moves them to
src/c++11/compatibility-thread-c++0x.cc

        PR libstdc++/54297
        * src/c++11/future.cc (~_Async_state_common): Move to...
        * src/c++11/compatibility-thread-c++0x.cc (~_Async_state_common):
        Here.
        (_GLIBCXX_ABI_COMPAT_ASYNC): Rename to _GLIBCXX_ASYNC_ABI_COMPAT.
        * include/std/future (_GLIBCXX_ABI_COMPAT_ASYNC): Likewise.

Tested x86_64-linux, committed to trunk and 4.7

Attachment: patch.txt
Description: Text document


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