Fix data races when using multi threading
This is a continuation of #2 (comment 699247459). Unfortunately there are many more static global objects that all need thread_local
to make them thread safe. As far as I understand all of these objects are caches, and therefore having them thread-local should be OK. The only static global object that I didn't prefix with thread_local
is static Config _cfg;
in src/Config.cc, which would make configuration thread local, which in my opinion is not desirable.