v3: - Changed in test error message to "expected valid locale\n". - Removed _endthread from thread function. - Just initialize ptr->cached_locale instead of calling _setmbcp. - Using _beginthreadex instead of _beginthread. - Removed `__attribute__((unused))`.