mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-08 01:54:44 +00:00
dm: enhence the mevent API
There is one race issue between mevent callback (which is called in mevent_dispatch thread) and mevent_delete (which could be called in dev thread). And the callback is called after mevent_delete. libevent have the exactly same issue. The issue is decripted here: https://github.com/libevent/libevent/blob/master/whatsnew-2.1.txt The fixing is: We introduce a teardown callback to mevent and make sure there is no race issue between callback and teardown call. This patch updates the mevent API and the caller as well. Tracked-On: #1877 Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
@@ -634,7 +634,7 @@ virtio_input_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
vi->mevp = mevent_add(vi->fd, EVF_READ, virtio_input_read_event, vi);
|
||||
vi->mevp = mevent_add(vi->fd, EVF_READ, virtio_input_read_event, vi, NULL, NULL);
|
||||
if (vi->mevp == NULL) {
|
||||
WPRINTF(("vtinput: could not register event\n"));
|
||||
goto fail;
|
||||
|
||||
Reference in New Issue
Block a user