In the document, I found that fgets_unlocked() is not thread-safe. However, I am not sure that can I use fgets_unlocked() without using any lock in a multi-threaded code, but ensure that each thread will access a different file (no two threads will access the same file)?
CodePudding user response:
If each thread uses fgets
of any kind to read from different files and write to different buffers, you're safe. There's nothing shared between threads in that case.