Expand description
OS-backed thread-local storage
This crate provides a ThreadLocal
type as an alternative to
std::thread_local!
that allows per-object thread-local storage, while
providing a similar API. It always uses the thread-local storage primitives
provided by the OS.
On Unix systems, pthread-based thread-local storage is used.
On Windows, fiber-local storage is used. This acts like thread-local
storage when fibers are unused, but also provides per-fiber values
after fibers are created with e.g. winapi::um::winbase::CreateFiber
.
See ThreadLocal
for more details.
The thread_local
crate also
provides per-object thread-local storage, with a different API, and
different features, but with more performance overhead than this one.
Structsยง
- An error returned by
ThreadLocal::try_with
. - A thread-local storage handle.