*/
#ifdef _GLIBCXX_HAS_GTHREADS
+ /// @cond undocumented
+
// Common base class for std::mutex and std::timed_mutex
class __mutex_base
{
__mutex_base(const __mutex_base&) = delete;
__mutex_base& operator=(const __mutex_base&) = delete;
};
+ /// @endcond
- /// The standard mutex type.
+ /** The standard mutex type.
+ *
+ * A simple, non-recursive, non-timed mutex.
+ *
+ * Do not call `lock()` and `unlock()` directly, use a scoped lock type
+ * such as `std::unique_lock`, `std::lock_guard`, or (since C++17)
+ * `std::scoped_lock`.
+ *
+ * @headerfile mutex
+ * @since C++11
+ */
class mutex : private __mutex_base
{
public:
{ return &_M_mutex; }
};
+ /// @cond undocumented
+
// Implementation details for std::condition_variable
class __condvar
{
__gthread_cond_t _M_cond;
#endif
};
+ /// @endcond
#endif // _GLIBCXX_HAS_GTHREADS
*
* A lock_guard controls mutex ownership within a scope, releasing
* ownership in the destructor.
+ *
+ * @headerfile mutex
+ * @since C++11
*/
template<typename _Mutex>
class lock_guard
*/
#ifdef _GLIBCXX_HAS_GTHREADS
+ /// @cond undocumented
// Common base class for std::recursive_mutex and std::recursive_timed_mutex
class __recursive_mutex_base
{ __gthread_recursive_mutex_destroy(&_M_mutex); }
#endif
};
+ /// @endcond
- /// The standard recursive mutex type.
+ /** The standard recursive mutex type.
+ *
+ * A recursive mutex can be locked more than once by the same thread.
+ * Other threads cannot lock the mutex until the owning thread unlocks it
+ * as many times as it was locked.
+ *
+ * @headerfile mutex
+ * @since C++11
+ */
class recursive_mutex : private __recursive_mutex_base
{
public:
};
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
+ /// @cond undocumented
+
template<typename _Derived>
class __timed_mutex_impl
{
return false;
}
};
+ /// @endcond
- /// The standard timed mutex type.
+ /** The standard timed mutex type.
+ *
+ * A non-recursive mutex that supports a timeout when trying to acquire the
+ * lock.
+ *
+ * @headerfile mutex
+ * @since C++11
+ */
class timed_mutex
: private __mutex_base, public __timed_mutex_impl<timed_mutex>
{
#endif
};
- /// recursive_timed_mutex
+ /** The standard recursive timed mutex type.
+ *
+ * A recursive mutex that supports a timeout when trying to acquire the
+ * lock. A recursive mutex can be locked more than once by the same thread.
+ * Other threads cannot lock the mutex until the owning thread unlocks it
+ * as many times as it was locked.
+ *
+ * @headerfile mutex
+ * @since C++11
+ */
class recursive_timed_mutex
: private __recursive_mutex_base,
public __timed_mutex_impl<recursive_timed_mutex>
*
* A scoped_lock controls mutex ownership within a scope, releasing
* ownership in the destructor.
+ *
+ * @headerfile mutex
+ * @since C++17
*/
template<typename... _MutexTypes>
class scoped_lock