Skip to content

Commit 3b8fee7

Browse files
committed
issue: 4432879 Remove free_evh_resources()
This method simply calls stop_thread(). Remove it to simply the code and separate thread stopping from epfd closing. Signed-off-by: Dmytro Podgornyi <[email protected]>
1 parent 9e5801d commit 3b8fee7

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

src/core/event/event_handler_manager.cpp

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -227,38 +227,31 @@ event_handler_manager::event_handler_manager(bool internal_thread_mode)
227227
m_epfd = -1;
228228
m_event_handler_tid = 0;
229229

230+
m_b_continue_running = true;
230231
if (!internal_thread_mode) {
231-
m_b_continue_running = true;
232232
return;
233233
}
234234

235235
m_epfd = SYSCALL(epoll_create, INITIAL_EVENTS_NUM);
236236
BULLSEYE_EXCLUDE_BLOCK_START
237237
if (m_epfd == -1) {
238238
evh_logdbg("epoll_create failed on ibv device collection (errno=%d %m)", errno);
239-
free_evh_resources();
240239
throw_xlio_exception("epoll_create failed on ibv device collection");
241240
}
242241
BULLSEYE_EXCLUDE_BLOCK_END
243242

244-
m_b_continue_running = true;
245-
246243
wakeup_set_epoll_fd(m_epfd);
247244
going_to_sleep();
248245
}
249246

250247
event_handler_manager::~event_handler_manager()
251248
{
252-
free_evh_resources();
253-
}
254-
255-
void event_handler_manager::free_evh_resources()
256-
{
257-
evh_logfunc("");
258-
259-
// Flag thread to stop on next loop
260249
stop_thread();
261-
evh_logfunc("Thread stopped");
250+
251+
if (m_epfd >= 0) {
252+
SYSCALL(close, m_epfd);
253+
}
254+
m_epfd = -1;
262255
}
263256

264257
// event handler main thread startup
@@ -370,18 +363,12 @@ void event_handler_manager::stop_thread()
370363
// Wait for thread exit
371364
if (m_event_handler_tid) {
372365
pthread_join(m_event_handler_tid, nullptr);
373-
evh_logdbg("event handler thread stopped");
366+
evh_logdbg("Event handler thread stopped.");
374367
} else {
375-
evh_logdbg("event handler thread not running");
368+
evh_logdbg("Event handler thread not running.");
376369
}
377370
}
378371
m_event_handler_tid = 0;
379-
380-
// Close main epfd and signaling socket
381-
if (m_epfd >= 0) {
382-
SYSCALL(close, m_epfd);
383-
}
384-
m_epfd = -1;
385372
}
386373

387374
void event_handler_manager::update_epfd(int fd, int operation, int events)

src/core/event/event_handler_manager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,6 @@ class event_handler_manager : public wakeup_pipe {
238238

239239
void event_channel_post_process_for_rdma_events(void *p_event);
240240
void *event_channel_pre_process_for_rdma_events(void *p_event_channel_handle, void **p_event);
241-
242-
void free_evh_resources(void);
243241
};
244242

245243
extern event_handler_manager *g_p_event_handler_manager;

0 commit comments

Comments
 (0)