index file readers: aquire shared lock
This commit is contained in:
parent
0465218953
commit
c597a92c81
|
@ -58,6 +58,10 @@ impl DynamicIndexReader {
|
|||
|
||||
let mut file = std::fs::File::open(&full_path)?;
|
||||
|
||||
if let Err(err) = nix::fcntl::flock(file.as_raw_fd(), nix::fcntl::FlockArg::LockSharedNonblock) {
|
||||
bail!("unable to get shared lock on {:?} - {}", full_path, err);
|
||||
}
|
||||
|
||||
let header_size = std::mem::size_of::<DynamicIndexHeader>();
|
||||
|
||||
// todo: use static assertion when available in rust
|
||||
|
|
|
@ -57,6 +57,10 @@ impl FixedIndexReader {
|
|||
|
||||
let mut file = std::fs::File::open(&full_path)?;
|
||||
|
||||
if let Err(err) = nix::fcntl::flock(file.as_raw_fd(), nix::fcntl::FlockArg::LockSharedNonblock) {
|
||||
bail!("unable to get shared lock on {:?} - {}", full_path, err);
|
||||
}
|
||||
|
||||
let header_size = std::mem::size_of::<FixedIndexHeader>();
|
||||
|
||||
// todo: use static assertion when available in rust
|
||||
|
|
Loading…
Reference in New Issue