| 30 | } |
| 31 | |
| 32 | bool TFileLock::TryAcquire() { |
| 33 | try { |
| 34 | Flock(GetMode(Type) | LOCK_NB); |
| 35 | return true; |
| 36 | } catch (const TSystemError& e) { |
| 37 | if (e.Status() != EWOULDBLOCK) { |
| 38 | throw; |
| 39 | } |
| 40 | return false; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | void TFileLock::Release() { |
| 45 | Flock(LOCK_UN); |