Skip to content
Snippets Groups Projects
Commit bb454545 authored by Juergen Hannappel's avatar Juergen Hannappel
Browse files

Merge branch 'threadingFix' into 'controller'

have an additional sync variable

See merge request !3
parents 88f83bcf cff016d6
No related branches found
No related tags found
2 merge requests!4Python driver and data analysis part,!3have an additional sync variable
......@@ -24,6 +24,8 @@ static std::condition_variable syncCvToMain;
static std::mutex syncMutexToWorker;
static std::condition_variable syncCvToWorker;
static std::atomic<unsigned> nArmed(0);
static std::atomic<bool> mayStart(false);
static std::atomic<std::chrono::system_clock::time_point> lastThreadEnd(std::chrono::system_clock::time_point::min());
static std::atomic<unsigned long long> totalBytesWritten(0);
......@@ -45,7 +47,7 @@ void worker(const std::string& dataHandlerName,
}
{
std::unique_lock<decltype(syncMutexToWorker)> lock(syncMutexToWorker);
syncCvToWorker.wait(lock);
syncCvToWorker.wait(lock, []{return mayStart.load();});
}
auto timingGenerator = timing::base::newHandler(timingHandlerName, threadNo);
......@@ -140,6 +142,7 @@ int main(int argc, const char*argv[]) {
}
{
std::unique_lock<decltype(syncMutexToWorker)> lock(syncMutexToWorker);
mayStart = true;
syncCvToWorker.notify_all();
}
auto firstThreadStart = std::chrono::system_clock::now();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment