std::recur...imed_mutex(3)
β¨ NAME β¨
std::recursive_timed_mutex β bestie, it's the standard recursive timed mutex type, and she's serving lock energy π
πΈ SYNOPSIS πΈ
#include <mutex>
π Public Types
typedef __native_type * native_handle_typeβ the native handle type, raw and unfiltered, lowkey the passport to whatever the implementation is actually doing underneath π«Ά
π₯ Public Member Functions
recursive_timed_mutex (const recursive_timed_mutex &)=deleteβ copy constructor? deleted. gone. not happening. she does NOT do copies, periodt πvoid lock ()β locks the mutex. if it's already locked by this same thread, it just locks again like it's nothing β¨native_handle_type native_handle () noexceptβ hands you the native handle, and it's markednoexceptso it will not be throwing hands πrecursive_timed_mutex & operator= (const recursive_timed_mutex &)=deleteβ assignment operator? also deleted. no assigning, no copying, none of it πbool try_lock () noexceptβ tries to lock, returns whether it worked, and it'snoexceptso no surprises π¦template<class _Rep, class _Period> bool try_lock_for (const chrono::duration< _Rep, _Period > &__rtime)β tries to lock, but with a timeout β you give it a duration and it waits at most that long, bestie β³template<class _Clock, class _Duration> bool try_lock_until (const chrono::time_point< _Clock, _Duration > &__atime)β tries to lock until a specific point in time. clock in, clock out π°οΈvoid unlock ()β unlocks one level of locking. remember you have to unlock it as many times as you locked it, no skipping π
π Friends
class __timed_mutex_impl< recursive_timed_mutex >β the friend of the family, the implementation buddy that's allowed in the group chat π«Ά
π Detailed Description π
The standard recursive timed mutex type. Yes, the whole thing. Iconic behavior, no cap β¨
A recursive mutex that supports a timeout when trying to acquire the lock. So you get both the "lock it more than once" lifestyle AND the "wait, but only for so long" lifestyle. Main character combo fr fr π
A recursive mutex can be locked more than once by the same thread. That's the whole point β same thread, multiple locks, zero drama π§
Other threads cannot lock the mutex until the owning thread unlocks it as many times as it was locked. So if you locked it three times, bestie, you're unlocking it three times. It's giving counting, and you better keep up π
Lock it n times β unlock it n times. That's the deal. Every other thread is just sitting there waiting on you, and honestly? Same.
β Since
C++11β she's been here since C++11, an elder icon, we stan πΈ
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. So technically nobody wrote this, it just appeared, fully formed, like a butterfly π¦
okay that's the whole page, bestie β every flag, every signature, every template param, all of it, untouched and slaying π
sending you off with the vibe check: this page came from the libstdc++ crew, filed under std::recur...imed_mutex(3), and that's a wrap, mwah π
β¨
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms