[Pkg-owncloud-commits] [owncloud-client] 72/83: remove the _syncMutex and replace it by a simple bool
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat May 31 11:31:45 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 864f2cdc7d68b08672cb719a7c96f4db8aa5d874
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Thu May 29 11:34:25 2014 +0200
remove the _syncMutex and replace it by a simple bool
---
src/mirall/syncengine.cpp | 11 ++++-------
src/mirall/syncengine.h | 2 +-
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/mirall/syncengine.cpp b/src/mirall/syncengine.cpp
index 3dcfcf5..3e5c6c9 100644
--- a/src/mirall/syncengine.cpp
+++ b/src/mirall/syncengine.cpp
@@ -52,8 +52,7 @@ void csyncLogCatcher(int /*verbosity*/,
Logger::instance()->csyncLog( QString::fromUtf8(buffer) );
}
-/* static variables to hold the credentials */
-QMutex SyncEngine::_syncMutex;
+bool SyncEngine::_syncRunning = false;
SyncEngine::SyncEngine(CSYNC *ctx, const QString& localPath, const QString& remoteURL, const QString& remotePath, Mirall::SyncJournalDb* journal)
{
@@ -420,10 +419,8 @@ void SyncEngine::handleSyncError(CSYNC *ctx, const char *state) {
void SyncEngine::startSync()
{
- if (!_syncMutex.tryLock()) {
- qDebug() << Q_FUNC_INFO << "WARNING: Another sync seems to be running. Not starting a new one.";
- return;
- }
+ Q_ASSERT(!_syncRunning);
+ _syncRunning = true;
if( ! _csync_ctx ) {
qDebug() << "XXXXXXXXXXXXXXXX FAIL: do not have csync_ctx!";
@@ -671,9 +668,9 @@ void SyncEngine::finalize()
_stopWatch.stop();
_propagator.reset(0);
- _syncMutex.unlock();
_thread.quit();
_thread.wait();
+ _syncRunning = false;
emit finished();
}
diff --git a/src/mirall/syncengine.h b/src/mirall/syncengine.h
index c1034bd..5f9c6e1 100644
--- a/src/mirall/syncengine.h
+++ b/src/mirall/syncengine.h
@@ -104,7 +104,7 @@ private:
// cleanup and emit the finished signal
void finalize();
- static QMutex _syncMutex;
+ static bool _syncRunning; //true when one sync is running somewhere (for debugging)
SyncFileItemVector _syncedItems;
CSYNC *_csync_ctx;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list