Add thread_local compatibility macro
Fix syntax typo in task
Use THREAD_LOCAL macro in thread

Instead of C++11 keyword which is supported only by the latest
compilers.