fix lua_handler core at bootstrap fail

This commit is contained in:
zhjc1124
2023-06-05 06:12:45 +00:00
committed by ob-robot
parent 3dde860f3e
commit 4cf19e5877
2 changed files with 6 additions and 3 deletions

View File

@ -127,8 +127,9 @@ void ObUnixDomainListener::stop()
void ObUnixDomainListener::wait() void ObUnixDomainListener::wait()
{ {
if (IS_INIT) { if (IS_INIT && ATOMIC_LOAD(&running_)) {
worker_.join(); worker_.join();
ATOMIC_STORE(&running_, false);
} }
} }
@ -182,7 +183,7 @@ int ObUnixDomainListener::run()
OB_LOG(ERROR, "ObUnixDomainListener add listen to epoll failed", K(errno)); OB_LOG(ERROR, "ObUnixDomainListener add listen to epoll failed", K(errno));
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
} else { } else {
ATOMIC_STORE(&stop_, false); ATOMIC_STORE(&running_, true);
worker_ = std::thread([=]() { worker_ = std::thread([=]() {
lib::set_thread_name("LuaHandler"); lib::set_thread_name("LuaHandler");
lib::ObStackHeaderGuard stack_header_guard; lib::ObStackHeaderGuard stack_header_guard;

View File

@ -30,7 +30,8 @@ class ObUnixDomainListener
public: public:
explicit ObUnixDomainListener() explicit ObUnixDomainListener()
: is_inited_(false), : is_inited_(false),
stop_(true), stop_(false),
running_(false),
listen_fd_(-1) {} listen_fd_(-1) {}
~ObUnixDomainListener(); ~ObUnixDomainListener();
int init(); int init();
@ -43,6 +44,7 @@ private:
private: private:
bool is_inited_; bool is_inited_;
bool stop_; bool stop_;
bool running_;
int listen_fd_; int listen_fd_;
std::thread worker_; std::thread worker_;
}; };