Use __thread for compatibility with gcc <= 4.7.

Use __thread in place of thread_local.  This is necessary to compile using gcc
version 4.7.2, the version of gcc present in Debian stable (wheezy).