sur-behoffski <sur_behoff...@grouse.com.au> wrote: > So, I'm not sure if a thread-safe (i.e. locale-safe) version of mbrtowc > exists; if not, this needs to be addressed before a split-locale, > multi-threaded version is feasible. (LC_CTYPE race conditions?)
By definition, mbrtowc is thread safe. The question relates better to setlocale(), or rather to the underlying internal locale data. I don't think the current POSIX model lends itself to multiple locales within the same process. I have to wonder if a multi-threaded grep makes sense in any case; it would be a very suprising change in behavior if output from multiple files comes out interleaved, instead of in the order the files were specified on the command line. My two cents, of course. Thanks, Arnold