Micha Lenk - 2015-05-29

The previous patch segfaults in multithreaded tests that use TLS.
See attachment for a fixed patch that doesn't segfault.