std::recursive_timed_mutex(3cxx)

🌸 NAME 🌸

okay so std::recursive_timed_mutex is the main character of this page, and the manual name is 3cxx β€” we're in the C++ docs, bestie, and it's giving library royalty πŸ‘‘βœ¨

✨ SYNOPSIS ✨

you get it with:

#include <mutex>

and the inheritance situation is literally:

  • inherits __recursive_mutex_base
  • inherits __timed_mutex_impl< recursive_timed_mutex >

both of those, exactly as written. no cap 🫢

πŸŽ€ Public Types πŸŽ€

  • typedef __native_type * native_handle_type β€” the one public type, and it is the native handle type. that's the whole vibe check πŸ’…

πŸ’… Public Member Functions πŸ’…

okay bestie, here's the full roster β€” no skipping, because every signature matters:

  • recursive_timed_mutex (const recursive_timed_mutex &)=delete β€” copying it? absolutely deleted, not today πŸ’€
  • void lock () β€” locks the mutex. remember the recursive rules from the detailed description: the same thread can lock more than once, and other threads wait until the unlocks match the locks.
  • native_handle_type native_handle () noexcept β€” hands you the native_handle_type, and it's marked noexcept. slay.
  • recursive_timed_mutex & operator= (const recursive_timed_mutex &)=delete β€” assignment? deleted too, bestie πŸ™ˆ
  • bool try_lock () noexcept β€” tries to lock, and it's noexcept. that's it, that's the function.
  • template<class _Rep , class _Period > bool try_lock_for (const chrono::duration< _Rep, _Period > &__rtime) β€” timeout try-lock, taking const chrono::duration< _Rep, _Period > &__rtime. it's giving "wait a little" energy ⏳
  • template<class _Clock , class _Duration > bool try_lock_until (const chrono::time_point< _Clock, _Duration > &__atime) β€” timeout try-lock until a point in time, taking const chrono::time_point< _Clock, _Duration > &__atime. clock-based and iconic πŸ•°οΈ
  • void unlock () β€” unlocks. recursive mutex says unlock it as many times as it was locked, periodt πŸ”“

🫢 Friends 🫢

  • class __timed_mutex_impl< recursive_timed_mutex > β€” this one is a friend. yes, the whole friend list is just this, and we respect it 🫑

πŸ¦‹ Detailed Description πŸ¦‹

okay so the tea is:

this is the standard recursive timed mutex type. it's 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. literally the whole personality, no cap πŸ’–

⭐ Since ⭐

C++11, bestie. it's been serving since C++11 ✨

πŸ‘‘ Author πŸ‘‘

not a human author moment: Generated automatically by Doxygen for libstdc++ from the source code. thank you Doxygen and libstdc++ for the lore πŸ™


okay that's the page! source/version: libstdc++; page: std::recursive_timed_mutex(3cxx); date: the footer didn't bring one, so I'm not inventing one, bestie β€” no cap. bye and slay πŸ«ΆπŸ’…

πŸ“¦ where this page comes from