Skip to content

Commit

Permalink
fix: race condition when updating parent times
Browse files Browse the repository at this point in the history
Ensure parent directory times are reset before we can possibly say the
operation as a whole is complete
  • Loading branch information
Dr-Emann committed Apr 15, 2024
1 parent 4e66044 commit 2c44ba3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/applesauce/src/threads/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ impl Drop for OperationContext {
}

pub struct Context {
// Fields are dropped in top-down order, so ensure we update the parent's times before
// dropping the operation (which will notify that the operation is done if this is the last
// file).
_parent_reset: Option<Arc<ResetTimes>>,
operation: Arc<OperationContext>,
path: PathBuf,
orig_size: u64,
progress: Box<dyn progress::Task + Send + Sync>,
_parent_reset: Option<Arc<ResetTimes>>,
}

impl Drop for Context {
Expand Down

0 comments on commit 2c44ba3

Please sign in to comment.