try taskflow in mana_auto_replay for the replay side

This commit is contained in:
Florian Lüke 2025-01-04 01:25:47 +01:00
parent e426fb7628
commit 1e5a816330
3 changed files with 22 additions and 4 deletions

View file

@ -20,3 +20,10 @@ if (NOT mesytec-mvlc)
message(STATUS "${CMAKE_PROJECT_NAME}: Using mesytec-mvlc from ${CMAKE_CURRENT_SOURCE_DIR}/mesytec-mvlc") message(STATUS "${CMAKE_PROJECT_NAME}: Using mesytec-mvlc from ${CMAKE_CURRENT_SOURCE_DIR}/mesytec-mvlc")
add_subdirectory(mesytec-mvlc) add_subdirectory(mesytec-mvlc)
endif() endif()
if (NOT taskflow)
option(TF_BUILD_CUDA "Enables builds of cuda code" OFF)
option(TF_BUILD_TESTS "Enables builds of tests" OFF)
option(TF_BUILD_EXAMPLES "Enables builds of examples" OFF)
add_subdirectory(taskflow-3.8.0)
endif()

View file

@ -22,7 +22,7 @@ add_mnode_dev_executable(mesy_nng_pub_producer)
add_mnode_dev_executable(mesy_nng_sub_consumer) add_mnode_dev_executable(mesy_nng_sub_consumer)
add_mnode_dev_executable(mana_auto_replay) add_mnode_dev_executable(mana_auto_replay)
target_link_libraries(mana_auto_replay PRIVATE mana mnode::resources) target_link_libraries(mana_auto_replay PRIVATE mana mnode::resources Taskflow)
add_mnode_dev_executable(mana_nng_client) add_mnode_dev_executable(mana_nng_client)
target_link_libraries(mana_nng_client PRIVATE mana mnode::resources) target_link_libraries(mana_nng_client PRIVATE mana mnode::resources)
add_mnode_dev_executable(mana1) add_mnode_dev_executable(mana1)

View file

@ -41,6 +41,7 @@
#include <mutex> #include <mutex>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <sstream> #include <sstream>
#include <taskflow/taskflow.hpp>
#include "internal/argh.h" #include "internal/argh.h"
#include "internal/mana_analysis.h" #include "internal/mana_analysis.h"
@ -545,13 +546,23 @@ int main(int argc, char *argv[])
auto destSink = mana.sink; auto destSink = mana.sink;
mana.sink = serverPerfSink.get(); mana.sink = serverPerfSink.get();
std::thread replayThread(run_replay); // FIXME: clientQuit is useless when running the client loop blocking like this
// FIXME: this is useless when running the client loop blocking like this
std::atomic<bool> clientQuit = false; std::atomic<bool> clientQuit = false;
#if 0
std::thread replayThread(run_replay);
mana::nng_client_run(clientSocket, destSink, clientQuit); mana::nng_client_run(clientSocket, destSink, clientQuit);
if (replayThread.joinable()) if (replayThread.joinable())
replayThread.join(); replayThread.join();
fmt::print("Internal NngServerSink: {}\n", to_string(serverPerfSink->perf())); #else
tf::Taskflow tf;
tf.emplace(run_replay);
tf::Executor executor;
auto f = executor.run(tf);
mana::nng_client_run(clientSocket, destSink, clientQuit);
f.wait();
#endif
// fmt::print("Internalthis NngServerSink: {}\n", to_string(serverPerfSink->perf()));
} }
else else
{ {