client: ensure worker is joined on close()

This commit is contained in:
Michael Davidsaver
2020-04-04 06:46:11 -07:00
parent 9971b2ceec
commit d852758b7b
3 changed files with 16 additions and 1 deletions
+5
View File
@@ -378,6 +378,11 @@ void Context::Pvt::close()
conn->cleanup();
}
});
tcp_loop.join();
// ensure any in-progress callbacks have completed
manager.sync();
}
void Context::Pvt::poke()
+10
View File
@@ -99,6 +99,11 @@ struct evbase::Pvt : public epicsThreadRunable
}
virtual ~Pvt() {
join();
}
void join()
{
if(event_base_loopexit(base.get(), nullptr))
log_crit_printf(logerr, "evbase error while interrupting loop for %p\n", base.get());
worker.exitWait();
@@ -189,6 +194,11 @@ evbase::evbase(const std::string &name, unsigned prio)
evbase::~evbase() {}
void evbase::join()
{
pvt->join();
}
void evbase::sync()
{
call([](){});
+1 -1
View File
@@ -62,7 +62,7 @@ struct owned_ptr : public std::unique_ptr<T>
struct PVXS_API evbase {
explicit evbase(const std::string& name, unsigned prio=0);
~evbase();
void start();
void join();
void sync();