Closed raggi closed 11 years ago
Hrm. So you're saying that attr_threaded_accessor is the wrong approach?
I'm not sure tbh, the problem is that thread local storage is basically globals.
Right, attr_threaded_accessor basically obfuscates that; check the impl out in methlab.
Closing. Unclear to me what this applied to.
In order to be a good citizen, the ideal thing is to try to reduce the volume of thread local usage.
There are a few approaches to this, but one that can work quite well is to store a key for the thread by package. The problem with this approach is that it could create small reference leaks:
Cleaning this up can be hard, but for pooled data it should be possible to have hooks in the pool to clean it up.