Skip to content

Commit

Permalink
Fix move of with_lock
Browse files Browse the repository at this point in the history
  • Loading branch information
mulimoen committed Jun 19, 2024
1 parent df037f1 commit b5b8277
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 4 additions & 8 deletions netcdf/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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()) }))
}
}

Expand Down
2 changes: 1 addition & 1 deletion netcdf/src/par.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
error::{checked, Result},
with_lock,
utils::with_lock,
};

use netcdf_sys::nc_type;
Expand Down
2 changes: 1 addition & 1 deletion netcdf/src/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b5b8277

Please sign in to comment.