1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

start readFromDmaToStdOut in separate thread

Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
Niklas Eiling 2023-01-18 15:21:50 +01:00
parent 62cab0c4dc
commit 1e3294d14c

View file

@ -13,6 +13,7 @@
#include <string>
#include <algorithm>
#include <jansson.h>
#include <thread>
#include <CLI11.hpp>
#include <rang.hpp>
@ -151,12 +152,20 @@ int main(int argc, char* argv[])
const fpga::ConnectString parsedConnectString(connectStr);
parsedConnectString.configCrossBar(dma, aurora_channels);
std::unique_ptr<std::thread> stdInThread = nullptr;
if (!noDma && parsedConnectString.isDstStdout()) {
auto formatter = fpga::getBufferedSampleFormatter(outputFormat, 16);
readFromDmaToStdOut(std::move(dma), std::move(formatter));
} else if (!noDma && parsedConnectString.isSrcStdin()) {
// We copy the dma shared ptr but move the fomatter unqiue ptr as we don't need it
// in this thread anymore
stdInThread = std::make_unique<std::thread>(readFromDmaToStdOut, dma, std::move(formatter));
}
if (!noDma && parsedConnectString.isSrcStdin()) {
}
if (stdInThread) {
stdInThread->join();
}
} catch (const RuntimeError &e) {
logger->error("Error: {}", e.what());
return -1;