Adjusted thread local code to support iOS

- iOS compiler doesn't support thread local variables
- I use them a lot, so this is unfortunate
- I've created a ThreadLocal class that mimics the behavior
  using the posix thread local apis.
- It should get us by, albeit iOS will necessarily run slower
  when accessing these variables.
- Hopefully Apple will provide C++11 support eventually and
  we can get rid of these special cases.
- All references to "thread_local" have been replaced with
  a couple macros TL() and TLARRAY().
- Windows and OSX code should be the same as before when these
  macros expand.
- iOS will use the ThreadLocal and ThreadLocalArray classes.