c - Is open thread safe? -


Is it OK if two threads are open at the same time ()? How will I get an answer to this question?

Assume that calls are working on different files, and their flags can be O_RDONLY , O_WRONLY , or both.

Since you notice that they are separate files, then there is no problem.

It is no different that two separate processes open two separate files.

Edit: It would be advisable to mention the cow as a comment under the comment, it was not always the case. It depends on whether the libc you are using, the thread is secured in relation to the modern avatar open () calls.

Comments