Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
000e2fc9
Commit
000e2fc9
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
emphasize locked block
parent
0cc98bea
No related branches found
No related tags found
1 merge request
!1279
rm DelayedProgressHandler
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Base/Progress/ProgressHandler.cpp
+10
-8
10 additions, 8 deletions
Base/Progress/ProgressHandler.cpp
with
10 additions
and
8 deletions
Base/Progress/ProgressHandler.cpp
+
10
−
8
View file @
000e2fc9
...
@@ -31,15 +31,17 @@ void ProgressHandler::subscribe(Callback_t inform)
...
@@ -31,15 +31,17 @@ void ProgressHandler::subscribe(Callback_t inform)
void
ProgressHandler
::
incrementDone
(
size_t
ticks_done
)
void
ProgressHandler
::
incrementDone
(
size_t
ticks_done
)
{
{
static
std
::
mutex
single_mutex
;
static
std
::
mutex
single_mutex
;
std
::
unique_lock
<
std
::
mutex
>
single_lock
(
single_mutex
);
{
std
::
unique_lock
<
std
::
mutex
>
_
(
single_mutex
);
m_completed_nticks
+=
ticks_done
;
m_completed_nticks
+=
ticks_done
;
if
(
m_completed_nticks
>
m_expected_nticks
)
if
(
m_completed_nticks
>
m_expected_nticks
)
m_expected_nticks
=
m_completed_nticks
+
1
;
m_expected_nticks
=
m_completed_nticks
+
1
;
int
percentage_done
=
(
int
)(
100.
*
m_completed_nticks
/
m_expected_nticks
);
int
percentage_done
=
(
int
)(
100.
*
m_completed_nticks
/
m_expected_nticks
);
// fractional part is discarded, which is fine here:
// fractional part is discarded, which is fine here:
// the value 100 is only returned if everything is done
// the value 100 is only returned if everything is done
m_continuation_flag
=
(
!
m_inform
||
m_inform
(
percentage_done
))
&&
m_continuation_flag
;
m_continuation_flag
=
(
!
m_inform
||
m_inform
(
percentage_done
))
&&
m_continuation_flag
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment