|
NAMExlocale —
Thread-safe extended locale support
LIBRARYStandard C Library (libc, -lc)SYNOPSIS#include <xlocale.h>
DESCRIPTIONThe extended locale support includes a set of functions for setting thread-local locales, as well convenience functions for performing locale-aware calls with a specified locale.The core of the xlocale API is the locale_t type. This is an opaque type encapsulating a locale. Instances of this can be either set as the locale for a specific thread or passed directly to the _l suffixed variants of various standard C functions. Two special locale_t values are available:
The global locale is the locale set with the setlocale(3) function. SEE ALSOduplocale(3), freelocale(3), localeconv(3), newlocale(3), querylocale(3), uselocale(3)CONVENIENCE FUNCTIONSThe xlocale API includes a number of _l suffixed convenience functions. These are variants of standard C functions that have been modified to take an explicit locale_t parameter as the final argument or, in the case of variadic functions, as an additional argument directly before the format string. Each of these functions accepts either NULL or LC_GLOBAL_LOCALE. In these functions, NULL refers to the C locale, rather than the thread's current locale. If you wish to use the thread's current locale, then use the unsuffixed version of the function.These functions are exposed by including
For reference, a complete list of the locale-aware functions that are available in this form, along with the headers that expose them, is provided here:
STANDARDSThe functions conform to IEEE Std 1003.1-2008 (“POSIX.1”).HISTORYThe xlocale APIs first appeared in Darwin 8.0. This implementation was written by David Chisnall, under sponsorship from the FreeBSD Foundation and first appeared in FreeBSD 9.1.CAVEATSThe setlocale(3) function, and others in the family, refer to the global locale. Other functions that depend on the locale, however, will take the thread-local locale if one has been set. This means that the idiom of setting the locale using setlocale(3), calling a locale-dependent function, and then restoring the locale will not have the expected behavior if the current thread has had a locale set using uselocale(3). You should avoid this idiom and prefer to use the _l suffixed versions instead.
Visit the GSP FreeBSD Man Page Interface. |