From 139649fd617e42bc8bbeca7d93b15917077d2988 Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Wed, 9 Mar 2016 20:22:44 +0100 Subject: [PATCH] TaskManager::count() now returns std::size_t; release mutex before posting progress notification --- Foundation/include/Poco/TaskManager.h | 6 +++--- Foundation/src/TaskManager.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Foundation/include/Poco/TaskManager.h b/Foundation/include/Poco/TaskManager.h index c4c3aa8e7..30f95972e 100644 --- a/Foundation/include/Poco/TaskManager.h +++ b/Foundation/include/Poco/TaskManager.h @@ -86,7 +86,7 @@ public: TaskList taskList() const; /// Returns a copy of the internal task list. - int count() const; + std::size_t count() const; /// Returns the number of tasks in the internal task list. void addObserver(const AbstractObserver& observer); @@ -125,11 +125,11 @@ private: // // inlines // -inline int TaskManager::count() const +inline std::size_t TaskManager::count() const { FastMutex::ScopedLock lock(_mutex); - return (int) _taskList.size(); + return _taskList.size(); } diff --git a/Foundation/src/TaskManager.cpp b/Foundation/src/TaskManager.cpp index 1e2e6bc9a..77f2aa8f0 100644 --- a/Foundation/src/TaskManager.cpp +++ b/Foundation/src/TaskManager.cpp @@ -115,11 +115,12 @@ void TaskManager::taskStarted(Task* pTask) void TaskManager::taskProgress(Task* pTask, float progress) { - FastMutex::ScopedLock lock(_mutex); + ScopedLockWithUnlock lock(_mutex); if (_lastProgressNotification.isElapsed(MIN_PROGRESS_NOTIFICATION_INTERVAL)) { _lastProgressNotification.update(); + lock.unlock(); _nc.postNotification(new TaskProgressNotification(pTask, progress)); } }