mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 01:50:40 +02:00
replaced usleep with sleep_for
This commit is contained in:
parent
9ea8882c05
commit
78a6896ae9
@ -10,6 +10,8 @@
|
|||||||
#include "versionAPI.h"
|
#include "versionAPI.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <chrono>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
@ -399,7 +401,7 @@ void Detector::setPowerChip(bool on, Positions pos) {
|
|||||||
if ((pos.empty() || pos[0] == -1) && on && pimpl->size() > 3) {
|
if ((pos.empty() || pos[0] == -1) && on && pimpl->size() > 3) {
|
||||||
for (int i = 0; i != pimpl->size(); ++i) {
|
for (int i = 0; i != pimpl->size(); ++i) {
|
||||||
pimpl->Parallel(&Module::setPowerChip, {i}, on);
|
pimpl->Parallel(&Module::setPowerChip, {i}, on);
|
||||||
usleep(1000 * 1000);
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pimpl->Parallel(&Module::setPowerChip, pos, on);
|
pimpl->Parallel(&Module::setPowerChip, pos, on);
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <chrono>
|
||||||
|
#include <thread>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
@ -3160,7 +3162,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
|||||||
const int ERASE_TIME = 65;
|
const int ERASE_TIME = 65;
|
||||||
int count = ERASE_TIME + 1;
|
int count = ERASE_TIME + 1;
|
||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
usleep(1 * 1000 * 1000);
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
--count;
|
--count;
|
||||||
printf(
|
printf(
|
||||||
"%d%%\r",
|
"%d%%\r",
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstring> //strcpy
|
#include <cstring> //strcpy
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <chrono>
|
||||||
|
#include <thread>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sys/stat.h> // stat
|
#include <sys/stat.h> // stat
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -739,7 +741,7 @@ void Implementation::stopReceiver() {
|
|||||||
for (const auto &it : dataProcessor)
|
for (const auto &it : dataProcessor)
|
||||||
if (it->IsRunning())
|
if (it->IsRunning())
|
||||||
running = true;
|
running = true;
|
||||||
usleep(5000);
|
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
// create virtual file
|
// create virtual file
|
||||||
@ -763,7 +765,7 @@ void Implementation::stopReceiver() {
|
|||||||
for (const auto &it : dataStreamer)
|
for (const auto &it : dataStreamer)
|
||||||
if (it->IsRunning())
|
if (it->IsRunning())
|
||||||
running = true;
|
running = true;
|
||||||
usleep(5000);
|
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
status = RUN_FINISHED;
|
status = RUN_FINISHED;
|
||||||
@ -821,7 +823,8 @@ void Implementation::startReadout() {
|
|||||||
<< "waiting for all packets, previousValue:"
|
<< "waiting for all packets, previousValue:"
|
||||||
<< previousValue
|
<< previousValue
|
||||||
<< " totalPacketsReceived: " << totalPacketsReceived;
|
<< " totalPacketsReceived: " << totalPacketsReceived;
|
||||||
usleep(5 * 1000); /* TODO! Need to find optimal time **/
|
/* TODO! Need to find optimal time **/
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||||
previousValue = totalPacketsReceived;
|
previousValue = totalPacketsReceived;
|
||||||
totalPacketsReceived = 0;
|
totalPacketsReceived = 0;
|
||||||
for (const auto &it : listener)
|
for (const auto &it : listener)
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h> //usleep in some machines
|
#include <chrono>
|
||||||
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <zmq.h>
|
#include <zmq.h>
|
||||||
@ -76,8 +77,8 @@ ZmqSocket::ZmqSocket(const uint32_t portnumber, const char *ethip)
|
|||||||
PrintError();
|
PrintError();
|
||||||
throw sls::ZmqSocketError("Could not bind socket");
|
throw sls::ZmqSocketError("Could not bind socket");
|
||||||
}
|
}
|
||||||
// sleep for a few milliseconds to allow a slow-joiner
|
// sleep to allow a slow-joiner
|
||||||
usleep(200 * 1000);
|
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||||
};
|
};
|
||||||
|
|
||||||
int ZmqSocket::Connect() {
|
int ZmqSocket::Connect() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user