Using scoped thread local (WIP)

Closes https://github.com/PistonDevelopers/current/issues/49