I am not satisfied with the existing per-object tls library, so I made this.
The following is quoted from README
Efficient per-object thread-local storage implementation.
Unlike
thread_local
crate, it can release objects normally at the end of thread,
and will not move objects between multiple threads.Unlike
os-thread-local
crate, it only uses thestd::thread_local!
abstraction of rust standard library,
and does not use any other platform-related APIs.
This means that its capacity is not limited byPTHREAD_KEYS_MAX
.And its performance is relatively good,
value access for less than 64 threads is completely lock-free, and hasO(1)
time complexity.
But since we store thread id instd::thread_local!
, so we will be slightly slower thanstd::thread_local!
.