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?
The only difference is atomicity: open() with O_EXLOCK is atomic, whereas open() followed by flock() are two distinct operations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With