mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-08 10:04:42 +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:
@@ -707,7 +707,7 @@ virtio_net_tap_setup(struct virtio_net *net, char *devname)
|
||||
|
||||
if (vhost_fd < 0) {
|
||||
net->mevp = mevent_add(net->tapfd, EVF_READ,
|
||||
virtio_net_rx_callback, net);
|
||||
virtio_net_rx_callback, net, NULL, NULL);
|
||||
if (net->mevp == NULL) {
|
||||
WPRINTF(("Could not register event\n"));
|
||||
close(net->tapfd);
|
||||
|
||||
Reference in New Issue
Block a user