vt::EpochGuard struct

An epoch wrapper that provides an RAII-style mechanism for owning an epoch for the duration of a scope block.

When EpochGuard is created, it pushes the given epoch onto the epoch stack. When EpochGuard is destroyed, it pops the epoch. It can explicitly pop the epoch early.

EpochGuard is non-copyable.

Constructors, destructors, conversion operators

EpochGuard(EpochType ep) explicit
Construct the EpochGuard with a given epoch.
EpochGuard(const EpochGuard&) deleted
EpochGuard(EpochGuard&&) defaulted noexcept
~EpochGuard()
Destroy the EpochGuard, popping the managed epoch.

Public functions

auto operator=(const EpochGuard&) -> EpochGuard& deleted
auto operator=(EpochGuard&&) -> EpochGuard& defaulted noexcept
void pop()
Manually pop the managed epoch.
auto get_epoch() const -> EpochType noexcept
Obtain a handle to the managed epoch.

Function documentation

vt::EpochGuard::EpochGuard(EpochType ep) explicit

Construct the EpochGuard with a given epoch.

Parameters
ep the epoch to manage

The given epoch will be popped when EpochGuard is destroyed.

void vt::EpochGuard::pop()

Manually pop the managed epoch.

This operation effectively sets the managed epoch to vt::no_epoch

EpochType vt::EpochGuard::get_epoch() const noexcept

Obtain a handle to the managed epoch.

Returns the managed epoch, or vt::no_epoch if the managed epoch was popped