Skip to content

Commit 5dfdfbb

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 60b7ec7 commit 5dfdfbb

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
@@ -406,18 +399,12 @@ void event_handler_manager::stop_thread()
406399
// Wait for thread exit
407400
if (m_event_handler_tid) {
408401
pthread_join(m_event_handler_tid, nullptr);
409-
evh_logdbg("event handler thread stopped");
402+
evh_logdbg("Event handler thread stopped.");
410403
} else {
411-
evh_logdbg("event handler thread not running");
404+
evh_logdbg("Event handler thread not running.");
412405
}
413406
}
414407
m_event_handler_tid = 0;
415-
416-
// Close main epfd and signaling socket
417-
if (m_epfd >= 0) {
418-
SYSCALL(close, m_epfd);
419-
}
420-
m_epfd = -1;
421408
}
422409

423410
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)