FileRwLock separate "exclusive" from "exclusive+write"
Summary:
Previously, FileRwLock::write() would obtain an exclusive lock and poison the file at the same time.
In
D40572127 (https://github.com/facebook/hhvm/commit/
ff93c2382f878b226cfa269e0df93b9130f77aad), mjhostet observed "Is it expected that a write locker would usually want to change that, rather than simply locking/unlocking the file?"
He was right. It's useful to be able to obtain an exclusive lock without poisoning the file. This way, for instance, you can have one process which holds an exclusive lock but relinquishes it if someone does Ctrl+C. I use this feature extensively in the next diff in the stack.
This diff allows for flows like the following:
```
let guard = lock.exclusive()?; // obtain an exclusive lock
let guard = guard.write()?; // poison it, and start writing
*guard = 15;
let guard = guard.commit()?; // commit to disk, but retain the lock
drop(guard); // release the lock
```
Reviewed By: mjhostet
Differential Revision:
D40917437
fbshipit-source-id:
4f57d4ddcce6a9f2eef41a542de8b04751cac6dd