pub struct BufferPoolThreadCache;Expand description
Access to the calling thread’s local BufferPool caches.
This type hides the TLS layout used by pooled allocation and return. The
main TLS key owns the registry. It has a destructor, so thread exit drops
the registry and each TlsSizeClassCache flushes its remaining entries to
the class-global freelist.
Steady-state allocation and return first read TLS_SIZE_CLASS_CACHES_FAST.
If it points at this thread’s registry and the requested class cache is
initialized, the caller touches only thread-local memory. Missing TLS state
routes through cache_slow or push_slow, which access the owning TLS key,
install the fast pointer, and lazily initialize the class cache.
Rust’s access path for TLS values with destructors includes checks for access during or after destruction. Those checks are correct, but they are expensive on the hot pooled allocation/drop path. After first checked access, we cache a raw pointer to the same registry in a destructor-free TLS key and use that pointer for steady-state access.
If the checked key is unavailable during thread-local destruction, cache
access returns None and callers use the class-global freelist instead.
Implementations§
Auto Trait Implementations§
impl Freeze for BufferPoolThreadCache
impl RefUnwindSafe for BufferPoolThreadCache
impl Send for BufferPoolThreadCache
impl Sync for BufferPoolThreadCache
impl Unpin for BufferPoolThreadCache
impl UnsafeUnpin for BufferPoolThreadCache
impl UnwindSafe for BufferPoolThreadCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more