[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kpmcore] src/core: Fix mutex logic for cancelling operations.
From:       Andrius_Å tikonas <null () kde ! org>
Date:       2018-03-31 19:18:05
Message-ID: E1f2M0r-0007FM-UE () code ! kde ! org
[Download RAW message or body]

Git commit c1f4b36305d663f5b407d30d1a843a23525ff626 by Andrius Å tikonas.
Committed on 31/03/2018 at 19:17.
Pushed by stikonas into branch 'master'.

Fix mutex logic for cancelling operations.

M  +1    -8    src/core/operationrunner.cpp

https://commits.kde.org/kpmcore/c1f4b36305d663f5b407d30d1a843a23525ff626

diff --git a/src/core/operationrunner.cpp b/src/core/operationrunner.cpp
index 01771c7..7906172 100644
--- a/src/core/operationrunner.cpp
+++ b/src/core/operationrunner.cpp
@@ -73,9 +73,9 @@ void OperationRunner::run()
 
     for (int i = 0; i < numOperations(); i++) {
         suspendMutex().lock();
+        suspendMutex().unlock();
 
         if (!status || isCancelling()) {
-            suspendMutex().unlock();
             break;
         }
 
@@ -92,13 +92,6 @@ void OperationRunner::run()
         disconnect(op, &Operation::progress, this, &OperationRunner::progressSub);
 
         emit opFinished(i + 1, op);
-
-        suspendMutex().unlock();
-
-        // Sleep a little to give others a chance to suspend us. This should normally not be
-        // required -- is it possible that the compiler just optimizes our unlock/lock away
-        // if we don't sleep?
-        msleep(5);
     }
 
     if (automounter)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic