REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::detail::shared_dfa_slot Struct Reference

Process-wide per-regex DFA state keyed by regex_immutables*: a pool of shared_dfa_set, one per thread using the regex, and the flags every thread shares. More...

#include <onepass.hpp>

Public Attributes

std::mutex pool_mu
 Guards free only.
 
std::vector< std::unique_ptr< shared_dfa_set > > free
 Sets no thread holds.
 
std::atomic< std::uint64_t > generation {0}
 
std::atomic< bool > il_warmed {false}
 Set once this regex has been IL-candidate-scanned (any size): the first scan uses the cold regex_immutables::il_min_haystack, later ones il_warm_floor. Keyed on a scan, not on il_prefix_rev being built, which a corpus always below the floor would never reach.
 
std::atomic< const regex_immutables * > owner {nullptr}
 The regex this slot belongs to, or null once erase_shared_dfas has retired it. Validates a thread's last-hit cache in shared_dfa_for. Per slot, so one regex's destruction sends only its own users back to shared_dfa_map_mu (a global epoch would send every thread).
 

Detailed Description

Process-wide per-regex DFA state keyed by regex_immutables*: a pool of shared_dfa_set, one per thread using the regex, and the flags every thread shares.

Thread-safe: map insert/erase under shared_dfa_map_mu; the pool under pool_mu, held only to take or return a set, never during a scan. Slots are shared_ptr so a concurrent erase_shared_dfas (from a destructor) cannot free a slot a thread still holds a set from — the slot dies when the last holder, map or thread-local lease, releases it.

Member Data Documentation

◆ generation

std::atomic<std::uint64_t> real::detail::shared_dfa_slot::generation {0}

Moves when the program is rebuilt.


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