[v3] add missing dg-require to tests

Jonathan Wakely jwakely.gcc@gmail.com
Mon Nov 7 22:26:00 GMT 2011


On 7 November 2011 21:51, Jonathan Wakely wrote:
>
> Aha, this is a problem with all platforms where _GLIBCXX_HAVE_TLS is
> not defined, std::call_once uses std:function which assumes a copyable
> target object.
>
> I'm working on it ..
>

Fixed like so ...

        * include/std/mutex (call_once): Store closure in __once_functor
        as bound function wrapper might not be copyable.

The fix would be simpler but the lambda can't capture the parameter
pack directly because of PR c++/41933. Unfortunately the non-TLS
std::call_once implementation is quite wasteful, creating a function
wrapper, which is captured by a closure, which is stored in a
std::function.  IIRC the std::function has to be kept for backwards
compatibility, otherwise we could just store the closure and a pointer
to a function, like the TLS code but using a mutex to serialize calls.

Tested x86_64-linux and x86_64-netbsd5.1, committed to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: call_once_nontls.patch
Type: text/x-patch
Size: 629 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20111107/15df6d0f/attachment.bin>


More information about the Libstdc++ mailing list