thread safety level of fwide
Wed Nov 19 07:16:00 GMT 2014
fwide() is annotated as
Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock
in the glibc manual.
After reading it's source code, I think it should be marked with race:stream.
The reasoning is fwide() uses fp several times inside without holding the lock over all of them.
How do you think about that?
The fwide()'s code is as follows:
fwide (fp, mode)
/* Normalize the value. */
mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
if (mode == 0 || fp->_mode != 0)
/* The caller simply wants to know about the current orientation
or the orientation already has been determined. */
result = _IO_fwide (fp, mode);
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
More information about the Libc-help