Skip to content

Commit 9d5cf55

Browse files
committed
issue: 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 19bdde1 commit 9d5cf55

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
@@ -264,38 +264,31 @@ event_handler_manager::event_handler_manager(bool internal_thread_mode)
264264
m_epfd = -1;
265265
m_event_handler_tid = 0;
266266

267+
m_b_continue_running = true;
267268
if (!internal_thread_mode) {
268-
m_b_continue_running = true;
269269
return;
270270
}
271271

272272
m_epfd = SYSCALL(epoll_create, INITIAL_EVENTS_NUM);
273273
BULLSEYE_EXCLUDE_BLOCK_START
274274
if (m_epfd == -1) {
275275
evh_logdbg("epoll_create failed on ibv device collection (errno=%d %m)", errno);
276-
free_evh_resources();
277276
throw_xlio_exception("epoll_create failed on ibv device collection");
278277
}
279278
BULLSEYE_EXCLUDE_BLOCK_END
280279

281-
m_b_continue_running = true;
282-
283280
wakeup_set_epoll_fd(m_epfd);
284281
going_to_sleep();
285282
}
286283

287284
event_handler_manager::~event_handler_manager()
288285
{
289-
free_evh_resources();
290-
}
291-
292-
void event_handler_manager::free_evh_resources()
293-
{
294-
evh_logfunc("");
295-
296-
// Flag thread to stop on next loop
297286
stop_thread();
298-
evh_logfunc("Thread stopped");
287+
288+
if (m_epfd >= 0) {
289+
SYSCALL(close, m_epfd);
290+
}
291+
m_epfd = -1;
299292
}
300293

301294
// event handler main thread startup
@@ -407,18 +400,12 @@ void event_handler_manager::stop_thread()
407400
// Wait for thread exit
408401
if (m_event_handler_tid) {
409402
pthread_join(m_event_handler_tid, nullptr);
410-
evh_logdbg("event handler thread stopped");
403+
evh_logdbg("Event handler thread stopped.");
411404
} else {
412-
evh_logdbg("event handler thread not running");
405+
evh_logdbg("Event handler thread not running.");
413406
}
414407
}
415408
m_event_handler_tid = 0;
416-
417-
// Close main epfd and signaling socket
418-
if (m_epfd >= 0) {
419-
SYSCALL(close, m_epfd);
420-
}
421-
m_epfd = -1;
422409
}
423410

424411
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
@@ -255,8 +255,6 @@ class event_handler_manager : public wakeup_pipe {
255255

256256
void event_channel_post_process_for_rdma_events(void *p_event);
257257
void *event_channel_pre_process_for_rdma_events(void *p_event_channel_handle, void **p_event);
258-
259-
void free_evh_resources(void);
260258
};
261259

262260
extern event_handler_manager *g_p_event_handler_manager;

0 commit comments

Comments
 (0)