std::shared...ex::try_lock(3)
π std::shared_timed_mutex::try_lock π
okay bestie, this is the page for std::shared_timed_mutex::try_lock β title std::shared...ex::try_lock(3), manual name C++ Standard Libary (yes, that spelling is exactly what the header says). Welcome to the group chat. π
πΈ NAME πΈ
std::shared_timed_mutex::try_lock - std::shared_timed_mutex::try_lock
β¨ Synopsis β¨
bool try_lock(); (since C++14)
So itβs giving βtry to lock the mutex, but donβt wait around.β It returns immediately. On successful lock acquisition it returns true, otherwise it returns false. π
This function is allowed to fail spuriously and return false even if the mutex is not currently locked by any other thread. not a typo, bestie β spurious failure is legal. π
If try_lock is called by a thread that already owns the mutex in any mode (shared or exclusive), the behavior is undefined. undefined behavior, do not collect $200, do not pass go. π
Prior unlock() operation on the same mutex synchronizes-with (as defined in std::memory_order) this operation if it returns true. Note that prior lock() does not synchronize with this operation if it returns false. π¦
π Parameters π
(none)
π Return value π
true if the lock was acquired successfully, otherwise false.
π Exceptions π
Throws nothing.
π Example π
This section is incomplete Reason: no example
π See also π
lockβ locks the mutex, blocks if the mutex is not available (public member function)try_lock_forβ tries to lock the mutex, returns if the mutex has been unavailable for the specified timeout duration (public member function)try_lock_untilβ tries to lock the mutex, returns if the mutex has been unavailable until specified time point has been reached (public member function)unlockβ unlocks the mutex (public member function)- C documentation for
mtx_trylock
ποΈ Category: ποΈ
- * Todo no example
mwah π this page is from http://cppreference.com, version/date 2024.06.10 β catch you in the group chat, bestie π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms