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 <yuanyuan.zhao@linux.intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Yuanyuan Zhao 2021-11-22 16:52:29 +08:00 committed by wenlingz
parent deec4b24ef
commit 1aa04a61d6
1 changed files with 1 additions and 1 deletions

View File

@ -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) {