Skip to content

Commit

Permalink
replace lock closure by @lock
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Mar 22, 2024
1 parent 376f39c commit 93f9a7d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/mddf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ function mddf(
# Reset the number of frames read by each chunk
R_chunk[ichunk].files[1].nframes_read = 0
for _ in frame_range
local compute, frame_weight
# Read frame coordinates
compute, frame_weight = lock(read_lock) do
@lock read_lock begin
iframe, compute = goto_nextframe!(iframe, R, trajectory, to_compute_frames, options)
if compute
# Read frame for computing
Expand All @@ -209,10 +210,7 @@ function mddf(
frame_weight = R_chunk[ichunk].files[1].frame_weights[iframe]
# Display progress bar
options.silent || next!(progress)
else
frame_weight = 0.0
end
return compute, frame_weight
end # release reading lock
#
# Perform MDDF computation
Expand Down

0 comments on commit 93f9a7d

Please sign in to comment.