]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
thread (__thread_data_base, thread): Rename member functions to match coding style.
authorJonathan Wakely <jwakely.gcc@gmail.com>
Thu, 22 Jan 2009 22:33:02 +0000 (22:33 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 22 Jan 2009 22:33:02 +0000 (22:33 +0000)
2009-01-22  Jonathan Wakely  <jwakely.gcc@gmail.com>

* include/std/thread (__thread_data_base, thread): Rename member
functions to match coding style.
(thread::thread,thread::operator=): Define move operations.
* src/thread.cc (__thread_data_base, thread): Rename member functions.
* config/abi/pre/gnu.ver: Adjust.

From-SVN: r143577

libstdc++-v3/ChangeLog
libstdc++-v3/config/abi/pre/gnu.ver
libstdc++-v3/include/std/thread
libstdc++-v3/src/thread.cc

index d15f1d7c57111ad5494ae0b4d2871cffcda5407c..8ebbe316c1f26b6ac0c0df75d37e190442c26a58 100644 (file)
@@ -1,3 +1,11 @@
+2009-01-22  Jonathan Wakely  <jwakely.gcc@gmail.com>
+
+       * include/std/thread (__thread_data_base, thread): Rename member
+       functions to match coding style.
+       (thread::thread,thread::operator=): Define move operations.
+       * src/thread.cc (__thread_data_base, thread): Rename member functions.
+       * config/abi/pre/gnu.ver: Adjust.
+
 2009-01-22  Benjamin Kosnik  <bkoz@redhat.com>
 
        PR libstdc++/38384
index 40237a6a854e219c293a63864c2509ba04289284..7a034db1ec140dcac85ee919688488ec3678755a 100644 (file)
@@ -900,7 +900,7 @@ GLIBCXX_3.4.11 {
     _ZNSt10shared_ptrISt18__thread_data_baseED1Ev;
     _ZNSt12bad_weak_ptrD0Ev;
     _ZNSt12bad_weak_ptrD1Ev;
-    _ZNSt6thread14__start_threadEv;
+    _ZNSt6thread15_M_start_threadEv;
     _ZNSt6thread4joinEv;
     _ZNSt6thread6detachEv;
 
index 00fb018989f83882934798c85fb3de5ae87f69fe..e6ce0f71876bdfa78228f910ac4c17072f6b6fe6 100644 (file)
@@ -65,7 +65,7 @@ namespace std
     __thread_data_base() = default;
     virtual ~__thread_data_base() = default;
     
-    virtual void __run() = 0;
+    virtual void _M_run() = 0;
     
     __gthread_t        _M_thread_handle;
     __thread_data_ptr  _M_this_ptr;
@@ -80,7 +80,7 @@ namespace std
       : _M_func(std::forward<_Callable>(__f))
       { }
 
-      void __run()
+      void _M_run()
       { _M_func(); }
 
     private:
@@ -100,21 +100,29 @@ namespace std
     
     template<typename _Callable>
       explicit thread(_Callable __f)
-      : _M_thread_data(__make_thread_data(__f))
-      { __start_thread(); }
+      : _M_thread_data(_M_make_thread_data(__f))
+      { _M_start_thread(); }
 
     template<typename _Callable, typename... _Args>
       thread(_Callable&& __f, _Args&&... __args)
-      : _M_thread_data(__make_thread_data(std::bind(__f, __args...)))
-      { __start_thread(); }
+      : _M_thread_data(_M_make_thread_data(std::bind(__f, __args...)))
+      { _M_start_thread(); }
 
     ~thread()
     { detach(); }
 
     thread(const thread&) = delete;
-    thread(thread&&);
+    thread(thread&& __t)
+    { swap(__t); }
+
     thread& operator=(const thread&) = delete;
-    thread& operator=(thread&&);
+    thread& operator=(thread&& __t)
+    {
+      if (joinable())
+        detach();
+      swap(__t);
+      return *this;
+    }
 
     // members
     void 
@@ -150,17 +158,17 @@ namespace std
   private:
     template<typename _Callable>
       __thread_data_ptr 
-      __make_thread_data(_Callable&& __f)
+      _M_make_thread_data(_Callable&& __f)
       { 
        return __thread_data_ptr(
          new __thread_data<_Callable>(std::forward<_Callable>(__f)));
       }
     
     __thread_data_ptr
-    __make_thread_data(void(*__f)())
+    _M_make_thread_data(void(*__f)())
     { return __thread_data_ptr(new __thread_data<void(*)()>(__f)); }
     
-    void __start_thread();
+    void _M_start_thread();
 
     __thread_data_ptr  _M_thread_data;
     mutable mutex      _M_thread_data_mutex;
index b7a4f83a8e54c4a5cf4d1328e95d888b83dbcbff..ca934dd90599349c4256e141cfce50359f2c285c 100644 (file)
@@ -46,7 +46,7 @@ namespace std
 
        try
          {
-           __local_thread_data->__run();
+           __local_thread_data->_M_run();
          }
        catch(...)
          {
@@ -88,7 +88,7 @@ namespace std
   }
 
   void 
-  thread::__start_thread()
+  thread::_M_start_thread()
   {
     _M_thread_data->_M_this_ptr = _M_thread_data;
     int __e = __gthread_create(&_M_thread_data->_M_thread_handle,