Commit 38b50770 by Chris Fairles Committed by Paolo Carlini

1.cc: Join thread before program exits.

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
parent f35bf7a9
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> Benjamin Kosnik <bkoz@redhat.com>
* include/std/thread: New. * include/std/thread: New.
......
...@@ -45,14 +45,16 @@ int main() ...@@ -45,14 +45,16 @@ int main()
try try
{ {
std::thread t1(f); std::thread t1(f);
std::thread::id t1_id = t1.get_id(); std::thread::id t1_id = t1.get_id();
std::thread t2; std::thread t2;
t2.swap(std::move(t1)); t2.swap(std::move(t1));
VERIFY( t1.get_id() == std::thread::id() ); VERIFY( t1.get_id() == std::thread::id() );
VERIFY( t2.get_id() == t1_id ); VERIFY( t2.get_id() == t1_id );
t2.join();
} }
catch (const std::system_error&) catch (const std::system_error&)
{ {
......
...@@ -51,6 +51,8 @@ void test01() ...@@ -51,6 +51,8 @@ void test01()
VERIFY( t1.get_id() == std::thread::id() ); VERIFY( t1.get_id() == std::thread::id() );
VERIFY( t2.get_id() == t1_id ); VERIFY( t2.get_id() == t1_id );
t2.join();
} }
catch (const std::system_error&) catch (const std::system_error&)
{ {
...@@ -73,6 +75,8 @@ void test02() ...@@ -73,6 +75,8 @@ void test02()
std::swap(std::move(t1), t2); std::swap(std::move(t1), t2);
VERIFY( t2.get_id() == t1_id ); VERIFY( t2.get_id() == t1_id );
t2.join();
} }
catch (const std::system_error&) catch (const std::system_error&)
{ {
...@@ -95,6 +99,8 @@ void test03() ...@@ -95,6 +99,8 @@ void test03()
std::swap(t2, std::move(t1)); std::swap(t2, std::move(t1));
VERIFY( t2.get_id() == t1_id ); VERIFY( t2.get_id() == t1_id );
t2.join();
} }
catch (const std::system_error&) catch (const std::system_error&)
{ {
......
...@@ -42,6 +42,8 @@ namespace chr = std::chrono; ...@@ -42,6 +42,8 @@ namespace chr = std::chrono;
void foo() void foo()
{ {
bool test __attribute__((unused)) = true;
chr::system_clock::time_point begin = chr::system_clock::now(); chr::system_clock::time_point begin = chr::system_clock::now();
chr::microseconds ms(500); chr::microseconds ms(500);
......
...@@ -42,6 +42,8 @@ namespace chr = std::chrono; ...@@ -42,6 +42,8 @@ namespace chr = std::chrono;
void foo() void foo()
{ {
bool test __attribute__((unused)) = true;
chr::system_clock::time_point begin = chr::system_clock::now(); chr::system_clock::time_point begin = chr::system_clock::now();
chr::microseconds ms(500); chr::microseconds ms(500);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment