##// END OF EJS Templates
Fix lock bug
perrinel -
r819:baf81ae414e4
parent child
Show More
@@ -96,14 +96,13 QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid v
96 96 auto oldAcqRequest = acqIdentifierToAcqRequestMapIt->second;
97 97 varRequestIdCanceled = oldAcqRequest.m_VarRequestId;
98 98 }
99 // remove old acqIdentifier from the worker
100 impl->cancelVarRequest(oldAcqId);
101 // impl->m_AcqIdentifierToAcqRequestMap.erase(oldAcqId);
102 99
103 100 it->second.second = acqRequest.m_AcqIdentifier;
104
105
106 101 impl->unlock();
102
103 // remove old acqIdentifier from the worker
104 impl->cancelVarRequest(oldAcqId);
105 // impl->m_AcqIdentifierToAcqRequestMap.erase(oldAcqId);
107 106 }
108 107 else {
109 108 // First request for the variable, it must be stored and executed
@@ -344,6 +343,7 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::updateToNextRe
344 343 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::cancelVarRequest(
345 344 QUuid varRequestId)
346 345 {
346 qInfo() << "VariableAcquisitionWorkerPrivate::cancelVarRequest 0";
347 347 lockRead();
348 348 // get all AcqIdentifier in link with varRequestId
349 349 QVector<QUuid> acqIdsToRm;
@@ -359,23 +359,29 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::cancelVarReque
359 359 for (auto acqId : acqIdsToRm) {
360 360 removeAcqRequest(acqId);
361 361 }
362 qInfo() << "VariableAcquisitionWorkerPrivate::cancelVarRequest end";
362 363 }
363 364
364 365 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeAcqRequest(
365 366 QUuid acqRequestId)
366 367 {
368 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 0";
367 369 QUuid vIdentifier;
368 370 std::shared_ptr<IDataProvider> provider;
369 371 lockRead();
370 372 auto acqIt = m_AcqIdentifierToAcqRequestMap.find(acqRequestId);
373 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 1";
371 374 if (acqIt != m_AcqIdentifierToAcqRequestMap.cend()) {
372 375 vIdentifier = acqIt->second.m_vIdentifier;
373 376 provider = acqIt->second.m_Provider;
374 377
378 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 2";
375 379 auto it = m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier);
376 380 if (it != m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
381 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 3";
377 382 if (it->second.first == acqRequestId) {
378 383 // acqRequest is currently running -> let's aborting it
384 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 4";
379 385 unlock();
380 386
381 387 // Remove the current request from the worker
@@ -383,27 +389,34 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeAcqReque
383 389
384 390 // notify the request aborting to the provider
385 391 provider->requestDataAborting(acqRequestId);
392 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 5";
386 393 }
387 394 else if (it->second.second == acqRequestId) {
388 395 it->second.second = QUuid();
396 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 6";
389 397 unlock();
390 398 }
391 399 else {
400 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 7";
392 401 unlock();
393 402 }
394 403 }
395 404 else {
405 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 8";
396 406 unlock();
397 407 }
398 408 }
399 409 else {
410 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 9";
400 411 unlock();
401 412 }
402 413
414 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 10";
403 415 lockWrite();
404 416
405 417 m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqRequestId);
406 418 m_AcqIdentifierToAcqRequestMap.erase(acqRequestId);
407 419
408 420 unlock();
421 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 11";
409 422 }
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

Status change > Approved

You need to be logged in to leave comments. Login now