client: ensure worker is joined on close()
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user