]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
1.cc: Join thread before program exits.
authorChris Fairles <chris.fairles@gmail.com>
Sat, 13 Sep 2008 09:38:05 +0000 (09:38 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 13 Sep 2008 09:38:05 +0000 (09:38 +0000)
2008-09-13  Chris Fairles  <chris.fairles@gmail.com>

        * testsuite/30_threads/thread/algorithm/1.cc: Join thread before
        program exits.
        * testsuite/30_threads/thread/algorithm/2.cc: Likewise.
        * testsuite/30_threads/thread/this_thread/3.cc: Define test variable.
        * testsuite/30_threads/thread/this_thread/4.cc: Likewise.

Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r140338

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/30_threads/thread/algorithm/1.cc
libstdc++-v3/testsuite/30_threads/thread/algorithm/2.cc
libstdc++-v3/testsuite/30_threads/thread/this_thread/3.cc
libstdc++-v3/testsuite/30_threads/thread/this_thread/4.cc

index 249eba7a9315055e55d50a77a1f93e3d17103df7..bd89e6e1346c3b523e84e64c96e32cd85200f4bd 100644 (file)
@@ -1,4 +1,12 @@
-2008-09-12  Chris Fairles <chris.fairles@gmail.com>
+2008-09-13  Chris Fairles  <chris.fairles@gmail.com>
+
+        * testsuite/30_threads/thread/algorithm/1.cc: Join thread before
+        program exits.
+        * testsuite/30_threads/thread/algorithm/2.cc: Likewise.
+        * testsuite/30_threads/thread/this_thread/3.cc: Define test variable.
+        * testsuite/30_threads/thread/this_thread/4.cc: Likewise.
+
+2008-09-12  Chris Fairles  <chris.fairles@gmail.com>
            Benjamin Kosnik  <bkoz@redhat.com>
 
        * include/std/thread: New.
index 950ffb38bfe54c95ee6d38f3c9190887b4dcdc79..e70bbbbe6128fa4b7f54fa8ed6282778c65f7192 100644 (file)
@@ -45,14 +45,16 @@ int main()
 
   try 
     {
-       std::thread t1(f);
-       std::thread::id t1_id = t1.get_id();
-       
-       std::thread t2;
-       t2.swap(std::move(t1));
-       
-       VERIFY( t1.get_id() == std::thread::id() );
-       VERIFY( t2.get_id() == t1_id ); 
+      std::thread t1(f);
+      std::thread::id t1_id = t1.get_id();
+      
+      std::thread t2;
+      t2.swap(std::move(t1));
+      
+      VERIFY( t1.get_id() == std::thread::id() );
+      VERIFY( t2.get_id() == t1_id );
+      
+      t2.join();
     }
   catch (const std::system_error&)
     {
index f587aac0cb4016c29584437b16d6ed4c38e2bd65..5dfce5366c8b47178f94cf1d8965dadbf917d4d7 100644 (file)
@@ -51,6 +51,8 @@ void test01()
       
       VERIFY( t1.get_id() == std::thread::id() );
       VERIFY( t2.get_id() == t1_id );
+
+      t2.join();
     }
  catch (const std::system_error&)
    {
@@ -73,6 +75,8 @@ void test02()
       std::swap(std::move(t1), t2);
 
       VERIFY( t2.get_id() == t1_id );
+
+      t2.join();
     }
   catch (const std::system_error&)
     {
@@ -95,6 +99,8 @@ void test03()
       std::swap(t2, std::move(t1));
 
       VERIFY( t2.get_id() == t1_id );
+      
+      t2.join();
     }
   catch (const std::system_error&)
     {
index 335e41057fb16abc5420faaa1ab8fde764bf2ddb..564bd1f704e6ffcb4b159b6e87bea784fc6bca51 100644 (file)
@@ -42,6 +42,8 @@ namespace chr = std::chrono;
 
 void foo()
 {
+  bool test __attribute__((unused)) = true;
+
   chr::system_clock::time_point begin = chr::system_clock::now();
   chr::microseconds ms(500);
 
index 3612779142f412f3ebdf56e881b20327f78f37b0..54bef5bae31a22bf185b4cc6a60919fc3d25ebc0 100644 (file)
@@ -42,6 +42,8 @@ namespace chr = std::chrono;
 
 void foo()
 {
+  bool test __attribute__((unused)) = true;
+
   chr::system_clock::time_point begin = chr::system_clock::now();
   chr::microseconds ms(500);