std::mutex(3cxx)

πŸ’– NAME πŸ’–

std::mutex β€” the standard mutex type, bestie, and this page is from the 3cxx manual. She's simple, non-recursive, and non-timed, and she's about to get the full group-chat rundown πŸ’…


✨ SYNOPSIS ✨

#include <mutex>

Inherits __mutex_base.

πŸŽ€ Public Types πŸŽ€

  • typedef __native_type * native_handle_type β€” the native handle type, slay.

🌸 Public Member Functions 🌸

  • mutex (const mutex &)=delete β€” copying? not happening, it's deleted.
  • void lock () β€” the lock one (but bestie, read the warning below first πŸ‘€).
  • native_handle_type native_handle () noexcept β€” grab the native handle, noexcept and all.
  • mutex & operator= (const mutex &)=delete β€” assignment? also deleted, periodt.
  • bool try_lock () noexcept β€” tries the lock and returns bool, noexcept.
  • void unlock () β€” the unlock one (again: warning below, okay? 🫢).

πŸ¦‹ Detailed Description πŸ¦‹

The standard mutex type.

A simple, non-recursive, non-timed mutex.

Do not call lock() and unlock() directly β€” seriously, bestie, use a scoped lock type such as std::unique_lock, std::lock_guard, or (since C++17) std::scoped_lock.

This is the part where you let the scoped lock do the main character work. Calling lock() and unlock() by hand is not the vibe 😭

⭐ Since ⭐

C++11 β€” that's when this icon entered the chat πŸ’–


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. No human author to thank here, just Doxygen doing its thing πŸ’…


mwah πŸ’– β€” source/version libstdc++, page std::mutex(3cxx); the footer had no date line, so I'm not inventing one, bestie 🫢

πŸ“¦ where this page comes from