Skip to content

Commit

Permalink
Fix race condition in progress indicator (reported by Phaneron).
Browse files Browse the repository at this point in the history
  • Loading branch information
jkansanen committed Aug 5, 2015
1 parent b896aac commit 131980f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions par2creator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,7 @@ bool Par2Creator::ProcessData(u64 blockoffset, size_t blocklength)
{
// Update a progress indicator
u32 oldfraction = (u32)(1000 * progress / totaldata);
#pragma omp atomic
progress += blocklength;
u32 newfraction = (u32)(1000 * progress / totaldata);

Expand Down
1 change: 1 addition & 0 deletions par2repairer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2231,6 +2231,7 @@ bool Par2Repairer::ProcessData(u64 blockoffset, size_t blocklength)
{
// Update a progress indicator
u32 oldfraction = (u32)(1000 * progress / totaldata);
#pragma omp atomic
progress += blocklength;
u32 newfraction = (u32)(1000 * progress / totaldata);

Expand Down

0 comments on commit 131980f

Please sign in to comment.