Patchwork [v3] use NSDMI in C++11 mutex types

login
register
mail settings
Submitter Jonathan Wakely
Date Nov. 5, 2011, 12:59 p.m.
Message ID <CAH6eHdQs90gH-0OBGHxwNO+SsOTmWCgmxwdXkkM7_v60oXHMgQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/123838/
State New
Headers show

Comments

Jonathan Wakely - Nov. 5, 2011, 12:59 p.m.
Also use NSDMI for std::once_flag

        PR libstdc++/49894
        PR bootstrap/50982
        * include/std/mutex (once_flag): Use NSDMI.

tested x86_64-linux, committed to trunk.

Patch

Index: include/std/mutex
===================================================================
--- include/std/mutex	(revision 180749)
+++ include/std/mutex	(working copy)
@@ -760,11 +760,11 @@ 
   {
   private:
     typedef __gthread_once_t __native_type;
-    __native_type  _M_once;
+    __native_type  _M_once = __GTHREAD_ONCE_INIT;
 
   public:
     /// Constructor
-    constexpr once_flag() noexcept : _M_once(__GTHREAD_ONCE_INIT) { }
+    constexpr once_flag() noexcept = default;
 
     /// Deleted copy constructor
     once_flag(const once_flag&) = delete;