Fix move of with_lock

This commit is contained in:
Magnus Ulimoen 2024-06-19 19:40:58 +02:00
parent df037f1d10
commit b5b82773da
4 changed files with 7 additions and 11 deletions

View File

@ -174,7 +174,7 @@ jobs:
run: cargo test --verbose --workspace --exclude netcdf-src --features netcdf/mpi,derive
- name: Run example
run: cargo run --verbose --package netcdf-examples --features mpi,derive
run: cargo run --verbose --package netcdf-examples --features mpi
- name: Run example in parallel
run: mpirun -np 10 --oversubscribe -- target/debug/netcdf-examples

View File

@ -97,7 +97,7 @@ impl RawFile {
let f = get_ffi_from_path(path);
let mut ncid: nc_type = 0;
unsafe {
error::checked(super::with_lock(|| {
error::checked(with_lock(|| {
netcdf_sys::par::nc_open_par(
f.as_ptr().cast(),
options.bits(),
@ -140,7 +140,7 @@ impl RawFile {
let f = get_ffi_from_path(path);
let mut ncid: nc_type = -1;
unsafe {
error::checked(super::with_lock(|| {
error::checked(with_lock(|| {
netcdf_sys::par::nc_create_par(
f.as_ptr().cast(),
options.bits(),
@ -500,16 +500,12 @@ impl FileMut {
/// Open the file for new definitions
pub fn redef(&mut self) -> error::Result<()> {
error::checked(super::with_lock(|| unsafe {
netcdf_sys::nc_redef(self.ncid())
}))
error::checked(with_lock(|| unsafe { netcdf_sys::nc_redef(self.ncid()) }))
}
/// Close the file for new definitions
pub fn enddef(&mut self) -> error::Result<()> {
error::checked(super::with_lock(|| unsafe {
netcdf_sys::nc_enddef(self.ncid())
}))
error::checked(with_lock(|| unsafe { netcdf_sys::nc_enddef(self.ncid()) }))
}
}

View File

@ -1,6 +1,6 @@
use crate::{
error::{checked, Result},
with_lock,
utils::with_lock,
};
use netcdf_sys::nc_type;

View File

@ -194,7 +194,7 @@ impl<'g> Variable<'g> {
#[cfg(feature = "mpi")]
fn access_mode(&self, mode: crate::par::AccessMode) -> error::Result<()> {
error::checked(super::with_lock(|| unsafe {
error::checked(utils::with_lock(|| unsafe {
netcdf_sys::par::nc_var_par_access(
self.ncid,
self.varid,