From 0c4ae89cd9f63e0591eda953081beb9f43d6c479 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 20 Aug 2019 11:20:12 +0200 Subject: [PATCH] WIP --- slsDetectorSoftware/include/Detector.h | 3 +-- slsDetectorSoftware/include/multiSlsDetector.h | 3 --- slsDetectorSoftware/src/Detector.cpp | 2 -- slsDetectorSoftware/src/multiSlsDetector.cpp | 13 ++----------- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/slsDetectorSoftware/include/Detector.h b/slsDetectorSoftware/include/Detector.h index b01e4ada5..695266dea 100644 --- a/slsDetectorSoftware/include/Detector.h +++ b/slsDetectorSoftware/include/Detector.h @@ -201,8 +201,7 @@ class Detector { * Stops detector acquisition and then receiver (if enabled) * If no receiver enabled, you can skip this for normal acquisition (no abort) */ - void stopAcquisition();//TODO: cannot do this. for acquire, to stop acquisition, must not also do stop receiver(mutex) - // TODO: stopAcquire?? + void stopAcquisition(); /** * Clears the acquiring flag. This has to be done manually diff --git a/slsDetectorSoftware/include/multiSlsDetector.h b/slsDetectorSoftware/include/multiSlsDetector.h index 248638f2e..7995c4808 100755 --- a/slsDetectorSoftware/include/multiSlsDetector.h +++ b/slsDetectorSoftware/include/multiSlsDetector.h @@ -2268,9 +2268,6 @@ class multiSlsDetector : public virtual slsDetectorDefs { /** mutex to synchronize main and data processing threads */ mutable std::mutex mp; - /** mutex to synchronizedata processing and plotting threads */ - mutable std::mutex mg; - /** sets when the acquisition is finished */ bool jointhread{false}; diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index ca146d8ae..627233e54 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -665,7 +665,6 @@ void Detector::setRxZmqIP(const std::string &ip, Positions pos) { bool previouslyReceiverStreaming = getRxZmqDataStream(pos).squash(false); - // TODO! probably in one call pimpl->Parallel(&slsDetector::setReceiverStreamingIP, pos, ip); if (previouslyReceiverStreaming) { setRxZmqDataStream(false, pos); @@ -695,7 +694,6 @@ Result Detector::getClientZmqIp(Positions pos) const { void Detector::setClientZmqIp(const std::string &ip, Positions pos) { int previouslyClientStreaming = pimpl->enableDataStreamingToClient(-1); - // TODO! probably in one call ?? pimpl->Parallel(&slsDetector::setClientStreamingIP, pos, ip); if (previouslyClientStreaming != 0) { pimpl->enableDataStreamingToClient(0); diff --git a/slsDetectorSoftware/src/multiSlsDetector.cpp b/slsDetectorSoftware/src/multiSlsDetector.cpp index e2f76a495..cb2a978f1 100755 --- a/slsDetectorSoftware/src/multiSlsDetector.cpp +++ b/slsDetectorSoftware/src/multiSlsDetector.cpp @@ -830,9 +830,6 @@ void multiSlsDetector::startAcquisition(int detPos) { } void multiSlsDetector::stopAcquisition(int detPos) { - // locks to synchronize using client->receiver simultaneously (processing - // thread) - std::lock_guard lock(mg); if (detPos >= 0) { detectors[detPos]->stopAcquisition(); } else { @@ -3743,7 +3740,6 @@ int multiSlsDetector::acquire() { // verify receiver is idle if (receiver) { - std::lock_guard lock(mg); if (getReceiverStatus() != IDLE) { stopReceiver(); } @@ -3754,13 +3750,11 @@ int multiSlsDetector::acquire() { // resets frames caught in receiver if (receiver) { - std::lock_guard lock(mg); resetFramesCaught(); } // start receiver if (receiver) { - std::lock_guard lock(mg); startReceiver(); // let processing thread listen to these packets sem_post(&sem_newRTAcquisition); @@ -3770,7 +3764,6 @@ int multiSlsDetector::acquire() { // stop receiver if (receiver) { - std::lock_guard lock(mg); stopReceiver(); if (dataReady != nullptr) { sem_wait(&sem_endRTAcquisition); // waits for receiver's @@ -3832,10 +3825,8 @@ void multiSlsDetector::processData() { } } // get progress - { - std::lock_guard lock(mg); - caught = getFramesCaughtByReceiver(0); - } + caught = getFramesCaughtByReceiver(0); + // updating progress if (caught != -1) { setCurrentProgress(caught);