future (packaged_task::operator bool): Rename to...

2011-02-09  Jonathan Wakely  <jwakely.gcc@gmail.com>

	* include/std/future (packaged_task::operator bool): Rename to...
	(packaged_task::valid): ...this.
	* testsuite/30_threads/packaged_task/cons/1.cc: Adjust.
	* testsuite/30_threads/packaged_task/cons/2.cc: Adjust.
	* testsuite/30_threads/packaged_task/cons/move.cc: Adjust.
	* testsuite/30_threads/packaged_task/cons/move_assign.cc: Adjust.
	* testsuite/30_threads/packaged_task/cons/alloc.cc: Adjust.
	* testsuite/30_threads/packaged_task/members/invoke.cc: Adjust.
	* testsuite/30_threads/packaged_task/members/reset.cc: Adjust.
	* testsuite/30_threads/packaged_task/members/reset2.cc: Adjust.
	* testsuite/30_threads/packaged_task/members/swap.cc: Adjust.
	* testsuite/30_threads/packaged_task/members/boolconv.cc: Remove.
	* testsuite/30_threads/packaged_task/members/valid.cc: Add.

From-SVN: r169988
This commit is contained in:
Jonathan Wakely 2011-02-09 23:17:05 +00:00 committed by Jonathan Wakely
parent c79bb35514
commit 7a0269ded1
12 changed files with 54 additions and 36 deletions

View File

@ -1,3 +1,19 @@
2011-02-09 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/std/future (packaged_task::operator bool): Rename to...
(packaged_task::valid): ...this.
* testsuite/30_threads/packaged_task/cons/1.cc: Adjust.
* testsuite/30_threads/packaged_task/cons/2.cc: Adjust.
* testsuite/30_threads/packaged_task/cons/move.cc: Adjust.
* testsuite/30_threads/packaged_task/cons/move_assign.cc: Adjust.
* testsuite/30_threads/packaged_task/cons/alloc.cc: Adjust.
* testsuite/30_threads/packaged_task/members/invoke.cc: Adjust.
* testsuite/30_threads/packaged_task/members/reset.cc: Adjust.
* testsuite/30_threads/packaged_task/members/reset2.cc: Adjust.
* testsuite/30_threads/packaged_task/members/swap.cc: Adjust.
* testsuite/30_threads/packaged_task/members/boolconv.cc: Remove.
* testsuite/30_threads/packaged_task/members/valid.cc: Add.
2011-02-09 Paolo Carlini <paolo.carlini@oracle.com>
* doc/xml/manual/io.xml: Fix typo.

View File

@ -1,6 +1,6 @@
// <future> -*- C++ -*-
// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -1250,7 +1250,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
swap(packaged_task& __other)
{ _M_state.swap(__other._M_state); }
explicit operator bool() const { return static_cast<bool>(_M_state); }
bool
valid() const
{ return static_cast<bool>(_M_state); }
// Result retrieval
future<_Res>

View File

@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
// Copyright (C) 2009 Free Software Foundation, Inc.
// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -35,15 +35,15 @@ void test01()
using namespace __gnu_test;
packaged_task<int ()> p1;
VERIFY( !static_cast<bool>(p1) );
VERIFY( !p1.valid() );
packaged_task<int& ()> p2;
VERIFY( !static_cast<bool>(p2) );
VERIFY( !p2.valid() );
packaged_task<void ()> p3;
VERIFY( !static_cast<bool>(p3) );
VERIFY( !p3.valid() );
packaged_task<ClassType ()> p4;
VERIFY( !static_cast<bool>(p4) );
VERIFY( !p4.valid() );
packaged_task<AbstractClass& (int)> p5;
VERIFY( !static_cast<bool>(p5) );
VERIFY( !p5.valid() );
}
int main()

View File

@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
// Copyright (C) 2009 Free Software Foundation, Inc.
// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -46,15 +46,15 @@ void test01()
using std::packaged_task;
packaged_task<int ()> p1(f1);
VERIFY( static_cast<bool>(p1) );
VERIFY( p1.valid() );
packaged_task<int& ()> p2(f2);
VERIFY( static_cast<bool>(p2) );
VERIFY( p2.valid() );
packaged_task<void ()> p3(f3);
VERIFY( static_cast<bool>(p3) );
VERIFY( p3.valid() );
packaged_task<ClassType ()> p4(f4);
VERIFY( static_cast<bool>(p4) );
VERIFY( p4.valid() );
packaged_task<AbstractClass& (int)> p5(f5);
VERIFY( static_cast<bool>(p5) );
VERIFY( p5.valid() );
}
int main()

View File

@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
// Copyright (C) 2010 Free Software Foundation, Inc.
// Copyright (C) 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -40,7 +40,7 @@ void test01()
uneq_allocator<char> alloc(99);
packaged_task<int ()> p1(allocator_arg, alloc, f);
VERIFY( static_cast<bool>(p1) );
VERIFY( p1.valid() );
p1();
VERIFY( p1.get_future().get() == 5 );
}

View File

@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
// Copyright (C) 2009 Free Software Foundation, Inc.
// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -37,8 +37,8 @@ void test01()
// move
packaged_task<int()> p1(f1);
packaged_task<int()> p2(std::move(p1));
VERIFY( !static_cast<bool>(p1) );
VERIFY( static_cast<bool>(p2) );
VERIFY( !p1.valid() );
VERIFY( p2.valid() );
}
int main()

View File

@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
// Copyright (C) 2009 Free Software Foundation, Inc.
// Copyright (C) 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -37,8 +37,8 @@ void test01()
std::packaged_task<int()> p1;
std::packaged_task<int()> p2(gen);
p1 = std::move(p2);
VERIFY( static_cast<bool>(p1) );
VERIFY( !static_cast<bool>(p2) );
VERIFY( p1.valid() );
VERIFY( !p2.valid() );
}
int main()

View File

@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
// Copyright (C) 2009 Free Software Foundation, Inc.
// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -38,7 +38,7 @@ void test01()
p1();
VERIFY( static_cast<bool>(p1) );
VERIFY( p1.valid() );
VERIFY( f1.get() == 0 );
}

View File

@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
// Copyright (C) 2009 Free Software Foundation, Inc.
// Copyright (C) 2009. 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -39,7 +39,7 @@ void test01()
future<int> f1 = p1.get_future();
p1.reset();
VERIFY( static_cast<bool>(p1) );
VERIFY( p1.valid() );
future<int> f2 = p1.get_future();

View File

@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
// Copyright (C) 2009 Free Software Foundation, Inc.
// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -39,7 +39,7 @@ void test01()
p1();
p1.reset();
VERIFY( static_cast<bool>(p1) );
VERIFY( p1.valid() );
VERIFY( f1.get() == 0 );
std::future<int> f2 = p1.get_future();

View File

@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
// Copyright (C) 2009 Free Software Foundation, Inc.
// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -35,11 +35,11 @@ void test01()
std::packaged_task<int()> p1(zero);
std::packaged_task<int()> p2;
VERIFY( static_cast<bool>(p1) );
VERIFY( !static_cast<bool>(p2) );
VERIFY( p1.valid() );
VERIFY( !p2.valid() );
p1.swap(p2);
VERIFY( !static_cast<bool>(p1) );
VERIFY( static_cast<bool>(p2) );
VERIFY( !p1.valid() );
VERIFY( p2.valid() );
}
int main()

View File

@ -6,7 +6,7 @@
// { dg-require-gthreads "" }
// { dg-require-atomic-builtins "" }
// Copyright (C) 2009 Free Software Foundation, Inc.
// Copyright (C) 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -34,10 +34,10 @@ void test01()
bool test __attribute__((unused)) = true;
std::packaged_task<int()> p1;
VERIFY( !static_cast<bool>(p1) );
VERIFY( !p1.valid() );
std::packaged_task<int()> p2(zero);
VERIFY( static_cast<bool>(p2) );
VERIFY( p2.valid() );
}
int main()