Crate thread_object [−] [src]
This is an abstraction over usual thread-local storage, adding a special type which has a value for every thread.
This means that you can dynamically create TLS variables, as opposed to the classical fixed static variable. This means that you can store the object reference in a struct, and have many in the same thread.
It works by holding a TLS variable with a binary tree map associating unique object IDs with pointers to the object.
Performance wise, this is suboptimal, but it is portable contrary to most other approaches.
A multi-faced object.