Module regex_automata::util::pool::inner
source · Structs§
- CacheLine π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.
- PoolGuard π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.
- THREAD_ID πA thread local used to assign an ID to a thread.
Statics§
- COUNTER πAn atomic counter used to allocate thread IDs.
- THREAD_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.
- THREAD_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 calls
get
before putting the result of a previousget
call back into the pool. - THREAD_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.