std::recursive_mutex(3)
π std::recursive_mutex π
okay so bestie, listen. this page is from the Library Functions Manual, and it's about std::recursive_mutex β the mutex that actually lets you come back for seconds. no cap. it's giving main character energy in the C++ threading world and i'm obsessed. π¦
β¨ NAME β¨
std::recursive_mutex β the standard recursive mutex type, fr fr π
πΈ SYNOPSIS πΈ
#include <mutex>
π Public Types π
typedef __native_type * native_handle_typeβ the native handle type, the lil pointer that lets you get all up close and personal with the underlying implementation π«Ά
π Public Member Functions π
recursive_mutex (const recursive_mutex &)=deleteβ nope, you cannot copy it. deleted. it's not that kind of mutex, bestie πvoid lock ()β locks it up π₯native_handle_type native_handle () noexceptβ hands you the native handle, and it'snoexceptso it will not be dramatic about it β¨recursive_mutex & operator= (const recursive_mutex &)=deleteβ also deleted. no assigning. no passing it around like a group chat screenshot πbool try_lock () noexceptβ tries to lock, tells you yes or no, and it'snoexceptso no surprises πvoid unlock ()β unlocks it π
π Detailed Description π
so the whole vibe here is: it's the standard recursive mutex type.
here's the tea β β a recursive mutex can be locked more than once by the same thread. like, the same thread can just keep coming back and locking it again and again, no judgement.
but the other threads?? they're stuck outside. 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, you gotta unlock it three times. it's a whole matching-set situation. count your locks, bestie, or nobody's getting in. π§
β Since β
C++11 β old enough to be iconic, still slaying π
π«Ά Author π«Ά
Generated automatically by Doxygen for libstdc++ from the source code. (not me writing fanfic, the robots did it, and honestly? they ate.)
heads up: this page came straight out of libstdc++, so go thank the libstdc++ girlies for the whole thing. mwah π bye bestie, go lock responsibly β¨
π¦ 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