#include <concurrent_calls_guard.h>
RAII class that is used to return an error when concurrent calls to some functions are made.
Usage:
///< Calling f() and/or g() concurrently will return an error. class A { public: absl::StatusOr<...> f() { ASSIGN_OR_RETURN(const auto guard,
ConcurrentCallsGuard::TryAcquire(tracker_)); ... }
absl::StatusOr<...> g() {
...
}
private:
#define ASSIGN_OR_RETURN(lhs, rexpr)
Tracker for pending calls.
static absl::StatusOr< ConcurrentCallsGuard > TryAcquire(Tracker &tracker)
};
Definition at line 50 of file concurrent_calls_guard.h.
◆ ConcurrentCallsGuard() [1/2]
operations_research::math_opt::ConcurrentCallsGuard::ConcurrentCallsGuard |
( |
const ConcurrentCallsGuard & | | ) |
|
|
delete |
◆ ConcurrentCallsGuard() [2/2]
operations_research::math_opt::ConcurrentCallsGuard::ConcurrentCallsGuard |
( |
ConcurrentCallsGuard && | other | ) |
|
|
inlinenoexcept |
◆ ~ConcurrentCallsGuard()
operations_research::math_opt::ConcurrentCallsGuard::~ConcurrentCallsGuard |
( |
| ) |
|
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ TryAcquire()
Returns an errors status when concurrent calls are made, or a guard that must only be kept on stack during the execution of the call.
Definition at line 24 of file concurrent_calls_guard.cc.
The documentation for this class was generated from the following files: