(0000751)
|
wangp
|
2014-07-28 15:48
|
|
In POSIX and Windows, the stdio stream functions are thread-safe, protected by per-stream locks. The only extra book-keeping we actually do is the line number tracking. We do stuff like MR_line_number(*mf)++; without any synchronisation sometimes, which could be a problem but I think unlikely.
To solve it, we could acquire the stream lock manually with flockfile, call the *_unlocked function (where possible), update the line number while holding the stream lock, then call funlockfile.
MSVC has *_nolock functions but I don't see any functions to manually acquire the stream lock. We would probably need our own locks there.
It's probably not worth the effort. |
|