Added protection to not use __thread for MacOSX  <= 10.7 and gcc