#thread-local #tls #synchronization #multi-threading

no-std phoenix-tls

Utilities for creating always present thread locals

1 unstable release

0.1.0 Aug 1, 2021

#1237 in Concurrency

MIT/Apache

8KB
163 lines

Utilities for creating always present thread locals.

The phoenix_tls! macro creates a thread_local! style variable that is lazily initialized. If the thread_local is accessed after it's destroyed, a new temporary will be created using Default::default().

All phoenix thread locals (Phoenix) are internally reference counted heap allocated structures.

Additionally the user type receives two callbacks subscribe/unsubscribe, which are invoked at creation/desctruction. The address is stable between those two calls.

Dependencies

~11KB