Hi. Bruno Haible <br...@clisp.org> wrote:
> > In any case, gawk's use of it is (and will remain) single-threaded. > > It'd be nice if your fix did not pull in more libraries, like libpthread > > or whatever, since that would considerably complicate things for me, > > for no actual gain w.r.t. gawk. > > If you add these two lines to configure.ac: > gl_cv_func_setlocale_null_all_mtsafe=yes > gl_cv_func_setlocale_null_one_mtsafe=yes > no additional libraries will be needed. How? I don't use gnulib in gawk. > > I'm curious what is the use case for multithreaded dfa? > > One could speed up > grep -r PATTERN DIRECTORY_WITH_MANY_FILES > by a large factor (probably 4x or 5x, on a CPU with 8 threads). > This would be done by modifying 'grep' to process each file in a > separate thread. The kernel can feed the data of these files to 'grep' > in parallel. Only the output phase needs to serialize things. I suspect that exactly because of the output phase you won't see such a huge speedup in practice, but it's worth a shot. On the assumption that setlocale is the only blocker, I would rather see an additional `char *locale_name' parameter added to dfa_syntax. That way the caller can get the value and pass it in, and the dfa code becomes mt-safe at next to no cost. Thanks, Arnold