* @brief Tries to atomically decrement the internal counter by 1 if it is greater than 0; no blocking occurs regardless. * * @return `true` if decremented the internal counter, `false` otherwise. */
| 182 | * @return `true` if decremented the internal counter, `false` otherwise. |
| 183 | */ |
| 184 | bool try_acquire() |
| 185 | { |
| 186 | std::scoped_lock lock(mutex); |
| 187 | if (counter > 0) |
| 188 | { |
| 189 | --counter; |
| 190 | return true; |
| 191 | } |
| 192 | return false; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * @brief Tries to atomically decrement the internal counter by 1 if it is greater than 0; otherwise blocks until it is greater than 0 and can successfully decrement the internal counter, or the `rel_time` duration has been exceeded. |
nothing calls this directly
no outgoing calls
no test coverage detected