Fix build for Mac OS X. This required us to change the storage of ThreadEnvironment objects to once again be controlled by the ProcessEnvironment (as thread_local is not supported currently). However, we use "thread_local" or "__thread" to keep a pointer to the appropriate ThreadEnvironment object, allowing us to avoid the previous system's expensive lookup.