Crashpad
 
Loading...
Searching...
No Matches
crashpad::ScopedSpinGuard Class Referencefinal

A scoped mutual-exclusion guard wrapping a SpinGuardState with RAII semantics. More...

#include "util/synchronization/scoped_spin_guard.h"

Public Member Functions

 ScopedSpinGuard (const ScopedSpinGuard &)=delete
 
ScopedSpinGuardoperator= (const ScopedSpinGuard &)=delete
 
 ScopedSpinGuard (ScopedSpinGuard &&other) noexcept
 
ScopedSpinGuardoperator= (ScopedSpinGuard &&other)
 
 ScopedSpinGuard (SpinGuardState &locked_state)
 A ScopedSpinGuard wrapping a locked SpinGuardState.
 

Static Public Member Functions

static std::optional< ScopedSpinGuardTryCreateScopedSpinGuard (uint64_t timeout_nanos, SpinGuardState &state)
 Spins up to timeout_nanos nanoseconds trying to lock state.
 

Detailed Description

A scoped mutual-exclusion guard wrapping a SpinGuardState with RAII semantics.

Constructor & Destructor Documentation

◆ ScopedSpinGuard()

crashpad::ScopedSpinGuard::ScopedSpinGuard ( SpinGuardState & locked_state)
inline

A ScopedSpinGuard wrapping a locked SpinGuardState.

Parameters
[in,out]locked_stateA locked SpinGuardState. This method holds a pointer to state, so state must outlive the lifetime of this object.

Member Function Documentation

◆ TryCreateScopedSpinGuard()

static std::optional< ScopedSpinGuard > crashpad::ScopedSpinGuard::TryCreateScopedSpinGuard ( uint64_t timeout_nanos,
SpinGuardState & state )
inlinestatic

Spins up to timeout_nanos nanoseconds trying to lock state.

Parameters
[in]timeout_nanosThe timeout in nanoseconds after which this gives up trying to lock the spinlock and returns std::nullopt.
[in,out]stateThe spinlock state to attempt to lock. This method holds a pointer to state, so state must outlive the lifetime of this object.
Returns
The locked ScopedSpinGuard on success, or std::nullopt on timeout.

The documentation for this class was generated from the following file: