I'm not very familiar with threading in C, so [this is what I came up with](https://github.com/5paceManSpiff/candybar/tree/thread-local).  Unfortunately it crashes every time one of the jscore functions is run.