WCSLIB: Thread-safety

WCSLIB 5.15

- Main Page
- Related Pages
- Data Structures
- Files

Thread-safety

With the following exceptions WCSLIB 5.15 is thread-safe:

- The C code generated by Flex is not re-entrant. Flex does have the capacity for producing re-entrant scanners but they have a different API. This may be handled by a compile-time option in future but in the meantime calls to the header parsers should be serialized via a mutex.
- The low-level functions wcsnpv() and wcsnps() are not thread-safe but within the library itself they are only used by the Flex scanners wcspih() and wcsbth(). They would rarely need to be used by application programmers.
- Diagnostic functions that print the contents of the various structs, namely celprt(), linprt(), prjprt(), spcprt(), tabprt(), wcsprt(), and wcsperr() use printf() which is thread-safe by the POSIX requirement on `stdio`. However, this is only at the function level. Where multiple threads invoke these functions simultaneously their output is likely to be interleaved.
- wcserr_enable() sets a static variable and so is not thread-safe. However, this facility is not intended to be used dynamically. If detailed error messages are required, enable wcserr when execution starts and don't change it.