This commit is contained in:
maliakal_d 2019-08-20 11:20:12 +02:00
parent 38b7e23ac4
commit 0c4ae89cd9
4 changed files with 3 additions and 18 deletions

View File

@ -201,8 +201,7 @@ class Detector {
* Stops detector acquisition and then receiver (if enabled) * Stops detector acquisition and then receiver (if enabled)
* If no receiver enabled, you can skip this for normal acquisition (no abort) * 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) void stopAcquisition();
// TODO: stopAcquire??
/** /**
* Clears the acquiring flag. This has to be done manually * Clears the acquiring flag. This has to be done manually

View File

@ -2268,9 +2268,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
/** mutex to synchronize main and data processing threads */ /** mutex to synchronize main and data processing threads */
mutable std::mutex mp; mutable std::mutex mp;
/** mutex to synchronizedata processing and plotting threads */
mutable std::mutex mg;
/** sets when the acquisition is finished */ /** sets when the acquisition is finished */
bool jointhread{false}; bool jointhread{false};

View File

@ -665,7 +665,6 @@ void Detector::setRxZmqIP(const std::string &ip,
Positions pos) { Positions pos) {
bool previouslyReceiverStreaming = bool previouslyReceiverStreaming =
getRxZmqDataStream(pos).squash(false); getRxZmqDataStream(pos).squash(false);
// TODO! probably in one call
pimpl->Parallel(&slsDetector::setReceiverStreamingIP, pos, ip); pimpl->Parallel(&slsDetector::setReceiverStreamingIP, pos, ip);
if (previouslyReceiverStreaming) { if (previouslyReceiverStreaming) {
setRxZmqDataStream(false, pos); setRxZmqDataStream(false, pos);
@ -695,7 +694,6 @@ Result<std::string> Detector::getClientZmqIp(Positions pos) const {
void Detector::setClientZmqIp(const std::string &ip, void Detector::setClientZmqIp(const std::string &ip,
Positions pos) { Positions pos) {
int previouslyClientStreaming = pimpl->enableDataStreamingToClient(-1); int previouslyClientStreaming = pimpl->enableDataStreamingToClient(-1);
// TODO! probably in one call ??
pimpl->Parallel(&slsDetector::setClientStreamingIP, pos, ip); pimpl->Parallel(&slsDetector::setClientStreamingIP, pos, ip);
if (previouslyClientStreaming != 0) { if (previouslyClientStreaming != 0) {
pimpl->enableDataStreamingToClient(0); pimpl->enableDataStreamingToClient(0);

View File

@ -830,9 +830,6 @@ void multiSlsDetector::startAcquisition(int detPos) {
} }
void multiSlsDetector::stopAcquisition(int detPos) { void multiSlsDetector::stopAcquisition(int detPos) {
// locks to synchronize using client->receiver simultaneously (processing
// thread)
std::lock_guard<std::mutex> lock(mg);
if (detPos >= 0) { if (detPos >= 0) {
detectors[detPos]->stopAcquisition(); detectors[detPos]->stopAcquisition();
} else { } else {
@ -3743,7 +3740,6 @@ int multiSlsDetector::acquire() {
// verify receiver is idle // verify receiver is idle
if (receiver) { if (receiver) {
std::lock_guard<std::mutex> lock(mg);
if (getReceiverStatus() != IDLE) { if (getReceiverStatus() != IDLE) {
stopReceiver(); stopReceiver();
} }
@ -3754,13 +3750,11 @@ int multiSlsDetector::acquire() {
// resets frames caught in receiver // resets frames caught in receiver
if (receiver) { if (receiver) {
std::lock_guard<std::mutex> lock(mg);
resetFramesCaught(); resetFramesCaught();
} }
// start receiver // start receiver
if (receiver) { if (receiver) {
std::lock_guard<std::mutex> lock(mg);
startReceiver(); startReceiver();
// let processing thread listen to these packets // let processing thread listen to these packets
sem_post(&sem_newRTAcquisition); sem_post(&sem_newRTAcquisition);
@ -3770,7 +3764,6 @@ int multiSlsDetector::acquire() {
// stop receiver // stop receiver
if (receiver) { if (receiver) {
std::lock_guard<std::mutex> lock(mg);
stopReceiver(); stopReceiver();
if (dataReady != nullptr) { if (dataReady != nullptr) {
sem_wait(&sem_endRTAcquisition); // waits for receiver's sem_wait(&sem_endRTAcquisition); // waits for receiver's
@ -3832,10 +3825,8 @@ void multiSlsDetector::processData() {
} }
} }
// get progress // get progress
{ caught = getFramesCaughtByReceiver(0);
std::lock_guard<std::mutex> lock(mg);
caught = getFramesCaughtByReceiver(0);
}
// updating progress // updating progress
if (caught != -1) { if (caught != -1) {
setCurrentProgress(caught); setCurrentProgress(caught);