From 1aa04a61d66f114fb3a1d5f09fe6ca75b7717820 Mon Sep 17 00:00:00 2001 From: Yuanyuan Zhao Date: Mon, 22 Nov 2021 16:52:29 +0800 Subject: [PATCH] dm: fix mevent timing issue If a file descriptor being monitored by epoll_wait is closed in another thread, the result is unspecified. So add all mevents removed in other threads to delete list. And drain the list in the dispatch mevent thread. Tracked-On: #6877 Signed-off-by: Yuanyuan Zhao Acked-by: Wang, Yu1 --- devicemodel/core/mevent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devicemodel/core/mevent.c b/devicemodel/core/mevent.c index 7dfa9cea8..40d4dc38e 100644 --- a/devicemodel/core/mevent.c +++ b/devicemodel/core/mevent.c @@ -341,7 +341,7 @@ mevent_delete_event(struct mevent *evp, int closefd) evp->closefd = closefd; epoll_ctl(epoll_fd, EPOLL_CTL_DEL, evp->me_fd, NULL); - if (!is_dispatch_thread() && evp->teardown != NULL) { + if (!is_dispatch_thread()) { mevent_add_to_del_list(evp, closefd); } else { if (evp->closefd) {