// <mutex> -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-// Free Software Foundation, Inc.
+// Copyright (C) 2003-2013 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
#pragma GCC system_header
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
#include <bits/gthr.h>
#include <bits/move.h> // for std::swap
-#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#ifdef _GLIBCXX_HAS_GTHREADS
// Common base class for std::mutex and std::timed_mutex
class __mutex_base
{
}
~__recursive_mutex_base()
- { _S_destroy(&_M_mutex); }
-
- private:
- // FIXME: gthreads doesn't define __gthread_recursive_mutex_destroy
- // so we need to obtain a __gthread_mutex_t to destroy
-
- // matches when there's only one mutex type
- template<typename _Rm>
- static
- typename enable_if<is_same<_Rm, __gthread_mutex_t>::value, void>::type
- _S_destroy(_Rm* __mx)
- { __gthread_mutex_destroy(__mx); }
-
- // matches a recursive mutex with a member 'actual'
- template<typename _Rm>
- static typename enable_if<(bool)sizeof(&_Rm::actual), void>::type
- _S_destroy(_Rm* __mx)
- { __gthread_mutex_destroy(&__mx->actual); }
-
- // matches a gthr-win32.h recursive mutex
- template<typename _Rm>
- static typename enable_if<(bool)sizeof(&_Rm::sema), void>::type
- _S_destroy(_Rm* __mx)
- {
- __gthread_mutex_t __tmp;
- _S_destroy_win32(&__tmp, __mx);
- }
-
- template<typename _Mx, typename _Rm>
- static void
- _S_destroy_win32(_Mx* __mx, _Rm const* __rmx)
- {
- __mx->counter = __rmx->counter;
- __mx->sema = __rmx->sema;
- __gthread_mutex_destroy(__mx);
- }
+ { __gthread_recursive_mutex_destroy(&_M_mutex); }
#endif
};
}
};
#endif
+#endif // _GLIBCXX_HAS_GTHREADS
/// Do not acquire ownership of the mutex.
struct defer_lock_t { };
}
}
+#ifdef _GLIBCXX_HAS_GTHREADS
/// once_flag
struct once_flag
{
if (__e)
__throw_system_error(__e);
}
+#endif // _GLIBCXX_HAS_GTHREADS
// @} group mutexes
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
+#endif // _GLIBCXX_USE_C99_STDINT_TR1
-#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
-
-#endif // __GXX_EXPERIMENTAL_CXX0X__
+#endif // C++11
#endif // _GLIBCXX_MUTEX