Fix thread-safety issues with TError
Fix thread-safety issues with TError

-There was a potential deadlock situation between gErrorMutex and
 gCINTMutex. The fix was to limit the scope of gErrorMutex locks
-Changed buffers from static to static thread_local. This allowed
 gErrorMutex to be more limited in scope.

tc3t/qoot,tc3t/qoot,tc3t/qoot,tc3t/qoot,tc3t/qoot,tc3t/qoot,tc3t/qoot,tc3t/qoot,tc3t/qoot,tc3t/qoot