[PATCH] string: New thread-safe strtok version
Florian Weimer
fweimer@redhat.com
Wed Apr 2 09:59:21 GMT 2025
* Andreas Schwab:
> On Apr 02 2025, Florian Weimer wrote:
>
>> Introduce a new symbol version, so that applications can rely
>> on the new behavior.
>
> What is the advantage of making strtok thread-safe, considering that
> strtok_r exists?
Compatibility with other libcs.
> Will other implementations follow so that POSIX can require it?
Solaris documents strok as thread-safe:
<https://docs.oracle.com/cd/E36784_01/html/E36874/strtok-r-3c.html>
The Windows versions is thread-safe as well:
<https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l?view=msvc-170>
So it wouldn't be a glibc invention.
Thanks,
Florian
More information about the Libc-alpha
mailing list