The reentrant version of the clearerr function is locked against multiple threads calling it simultaneously. This incurs overhead to ensure integrity of the stream. The unlocked version of this call, clearerr_unlocked can be used to avoid the overhead. The clearerr_unlocked macro is functionally identical to the clearerr macro, except that it is not required to be implemented in a thread-safe manner. The clearerr_unlocked function can be safely used only within a scope that is protected by the flockfile and funlockfile functions used as a pair. The caller must ensure that the stream is locked before clearerr_unlocked is used. See also flockfile, ftrylockfile, and funlockfile.