Reputation:
What is the difference between calling open()
with the O_EXLOCK
flag versus calling just calling open()
and then calling flock()
? The latter has a potential race condition, but other than that both ways gets an exclusive process lock on a file, right?
Upvotes: 3
Views: 2122
Reputation: 500703
The only difference is atomicity: open()
with O_EXLOCK
is atomic, whereas open()
followed by flock()
are two distinct operations.
Upvotes: 4