fix comment; don't send TaskProgressNotification if progress does not change

This commit is contained in:
Guenter Obiltschnig
2016-02-13 20:22:02 +01:00
parent d148a8a1f4
commit 94dbc1f34c
2 changed files with 7 additions and 4 deletions

View File

@@ -102,7 +102,7 @@ private:
class Foundation_API TaskProgressNotification: public TaskNotification class Foundation_API TaskProgressNotification: public TaskNotification
/// This notification is posted by the TaskManager for /// This notification is posted by the TaskManager for
/// every task that has failed with an exception. /// a task when its progress changes.
{ {
public: public:
TaskProgressNotification(Task* pTask, float progress); TaskProgressNotification(Task* pTask, float progress);

View File

@@ -95,10 +95,13 @@ void Task::setProgress(float taskProgress)
{ {
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
if (_progress != taskProgress)
{
_progress = taskProgress; _progress = taskProgress;
if (_pOwner) if (_pOwner)
_pOwner->taskProgress(this, _progress); _pOwner->taskProgress(this, _progress);
} }
}
void Task::setOwner(TaskManager* pOwner) void Task::setOwner(TaskManager* pOwner)