- Home /
Is [ThreadStatic] still bad practice?
Was the warning in code purely to stop people putting this on Unity structures? I assume we're safe using ThreadStatic on our own structures? Things like preallocated data buffers used by classes.
For example, in my compression class, which uses a preallocated buffer, making this ThreadStatic prevents me from having to threadlock every time I come to compress. Similar setup with preallocating a StringBuilder, or trying to use data packing like FlatBuffers. All fall apart without ThreadStatic.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612162626im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
What threads are used in a scene? 1 Answer
Jobs running over multiple frames 1 Answer