Module regex_automata::util::pool::inner
source · Structs§
- Cache
Line πThis puts each stack in the pool below into its own cache line. This is an absolutely critical optimization that tends to have the most impact in high contention workloads. Without forcing each mutex protected into its own cache line, high contention exacerbates the performance problem by causing βfalse sharing.β By putting each mutex in its own cache-line, we avoid the false sharing problem and the affects of contention are greatly reduced. - Pool πA thread safe pool utilizing std-only features.
- Pool
Guard πA guard that is returned when a caller requests a value from the pool.
Constants§
- MAX_
POOL_ πSTACKS The number of stacks we use inside of the pool. These are only used for non-owners. That is, these represent the βslowβ path. - THREA
D_ πID A thread local used to assign an ID to a thread.
Statics§
- COUNTER πAn atomic counter used to allocate thread IDs.
- THREA
D_ πID_ DROPPED This sentinel is used to indicate that a guard has already been dropped and should not be re-dropped. We use this because our drop code can be called outside of Drop and thus there could be a bug in the internal implementation that results in trying to put the same guard back into the same pool multiple times, and that could result in UB if we didnβt mark the guard as already having been put back in the pool. - THREA
D_ πID_ INUSE A thread ID indicating that the special owner value is in use and not available. This state is useful for avoiding a case where the owner of a pool callsget
before putting the result of a previousget
call back into the pool. - THREA
D_ πID_ UNOWNED A thread ID indicating that there is no owner. This is the initial state of a pool. Once a pool has an owner, there is no way to change it.