相当于 macOS 上的 fwrite_unlocked?

Equivalent of fwrite_unlocked on macOS?

我有一些代码在 Linux 和 Windows 上运行,我目前正在将其移植到 macOS。一个关键点是 fwrite_unlocked (Linux), which has an equivalent on Windows (_fwrite_nolock),但据我所知,macOS 上没有。现在我只使用 fwrite,但我想知道是否有更好的解决方案?这只会导致性能下降,还是如果我为此使用 fwrite 会冒更严重问题的风险?

根据该手册页,fwrite_unlockedfwrite 类似,但安全性较低。因此,使用 fwrite 没有 "more serious problems" 的风险。 fwrite 的性能似乎很可能会降低; _unlocked 函数的全部目的是更快。

请注意手册页中的这一点:

[The nonstandard *_unlocked() variants] should probably not be used.