summaryrefslogtreecommitdiff
path: root/src/sync-service/SyncManager_SyncJobDispatcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sync-service/SyncManager_SyncJobDispatcher.cpp')
-rw-r--r--src/sync-service/SyncManager_SyncJobDispatcher.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/sync-service/SyncManager_SyncJobDispatcher.cpp b/src/sync-service/SyncManager_SyncJobDispatcher.cpp
index 1e19a1a..34ea7ac 100644
--- a/src/sync-service/SyncManager_SyncJobDispatcher.cpp
+++ b/src/sync-service/SyncManager_SyncJobDispatcher.cpp
@@ -212,9 +212,20 @@ SyncJobDispatcher::TryStartingNextJobLocked()
pthread_mutex_lock(&(SyncManager::GetInstance()->__syncJobQueueMutex));
SyncJobQueue* pSyncJobQueue = SyncManager::GetInstance()->GetSyncJobQueue();
+ if (pSyncJobQueue == NULL) {
+ LOG_LOGD("pSyncJobQueue is null");
+ return;
+ }
list< SyncJob* >& jobQueue = pSyncJobQueue->GetSyncJobQueue();
+ if (jobQueue.empty()) {
+ LOG_LOGD("jobQueue is empty");
+ }
+
list< SyncJob* >& priorityJobQueue = pSyncJobQueue->GetPrioritySyncJobQueue();
+ if (priorityJobQueue.empty()) {
+ LOG_LOGD("priorityJobQueue is empty");
+ }
if (jobQueue.empty() && priorityJobQueue.empty())
{
@@ -227,6 +238,7 @@ SyncJobDispatcher::TryStartingNextJobLocked()
if (!jobQueue.empty())
{
+ LOG_LOGD("jobQueue is filled");
SyncJob* nonPrioritySyncJob = jobQueue.front();
if (nonPrioritySyncJob->__waitCounter > NON_PRIORITY_SYNC_WAIT_LIMIT)
{
@@ -246,21 +258,25 @@ SyncJobDispatcher::TryStartingNextJobLocked()
if (syncJobToRun == NULL && !jobQueue.empty())
{
LOG_LOGD("Non priority job found.");
+ LOG_LOGD("Non priority size : %d", jobQueue.size());
syncJobToRun = jobQueue.front();
jobQueue.pop_front();
- LOG_LOGD("Non priority size.%d", jobQueue.size());
+ LOG_LOGD("Non priority size : %d", jobQueue.size());
+ if (syncJobToRun == NULL)
+ LOG_LOGD("syncJobToRun is null");
+
}
+ pthread_mutex_unlock(&(SyncManager::GetInstance()->__syncJobQueueMutex));
if (syncJobToRun != NULL)
{
int ret = DispatchSyncJob(syncJobToRun);
if (ret != SYNC_ERROR_NONE)
{
- SyncManager::GetInstance()->ScheduleSyncJob(syncJobToRun, false);
LOG_LOGD("Failed to dispatch sync job. Adding it back to job queue");
+ SyncManager::GetInstance()->ScheduleSyncJob(syncJobToRun, false);
}
}
- pthread_mutex_unlock(&(SyncManager::GetInstance()->__syncJobQueueMutex));
}
//}//_SyncManager