This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[c++0x] remove std::lock_error
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 13 May 2009 21:53:51 +0100
- Subject: [c++0x] remove std::lock_error
std::lock_error was removed from the C++0x draft between n2691 and
n2723, it's unused in libstdc++ except for
testsuite/30_threads/headers/mutex/types_std_c++0x.cc but as its
exported it needs to be kept for binary compatibility.
* include/std/mutex: Move std::lock_error to ...
* src/mutex.cc: Here.
* testsuite/30_threads/headers/mutex/types_std_c++0x.cc: Add checks
for lock types and remove std::lock_error check.
tested x86_64 linux, is this OK for trunk?
Index: include/std/mutex
===================================================================
--- include/std/mutex (revision 147496)
+++ include/std/mutex (working copy)
@@ -386,18 +386,6 @@ namespace std
extern const try_to_lock_t try_to_lock;
extern const adopt_lock_t adopt_lock;
- /**
- * @brief Thrown to indicate errors with lock operations.
- *
- * @ingroup exceptions
- */
- class lock_error : public exception
- {
- public:
- virtual const char*
- _GLIBCXX_CONST what() const throw();
- };
-
/// @brief Scoped lock idiom.
// Acquire the mutex here with a constructor call, then release with
// the destructor call in accordance with RAII style.
Index: src/mutex.cc
===================================================================
--- src/mutex.cc (revision 147496)
+++ src/mutex.cc (working copy)
@@ -43,6 +43,18 @@ namespace std
const try_to_lock_t try_to_lock = try_to_lock_t();
const adopt_lock_t adopt_lock = adopt_lock_t();
+ /**
+ * @brief Removed from C++0x draft, preserved for ABI reasons
+ *
+ * @ingroup exceptions
+ */
+ class lock_error : public exception
+ {
+ public:
+ virtual const char*
+ _GLIBCXX_CONST what() const throw();
+ };
+
const char*
lock_error::what() const throw()
{ return "std::lock_error"; }
Index: testsuite/30_threads/headers/mutex/types_std_c++0x.cc
===================================================================
--- testsuite/30_threads/headers/mutex/types_std_c++0x.cc (revision 147496)
+++ testsuite/30_threads/headers/mutex/types_std_c++0x.cc (working copy)
@@ -35,7 +35,8 @@ void test01()
using std::try_to_lock;
using std::adopt_lock;
- typedef std::lock_error error_t;
+ typedef std::lock_guard<mutext_t> lock_t;
+ typedef std::unique_lock<rmutext_t> ulock_t;
typedef std::once_flag once_t;
}