static void * pci_vtnet_tap_select_func(void *vsc) { struct pci_vtnet_softc *sc; fd_set rfd; pthread_setname_np("net:tap:rx"); sc = vsc; assert(sc); assert(sc->vsc_tapfd != -1); FD_ZERO(&rfd); FD_SET(sc->vsc_tapfd, &rfd); while (1) { if (select((sc->vsc_tapfd + 1), &rfd, NULL, NULL, NULL) == -1) { abort(); } pthread_mutex_lock(&sc->rx_mtx); sc->rx_in_progress = 1; pci_vtnet_tap_rx(sc); sc->rx_in_progress = 0; pthread_mutex_unlock(&sc->rx_mtx); } return (NULL); }
static void pci_vtnet_tap_callback(int fd, enum ev_type type, void *param) { struct pci_vtnet_softc *sc = param; pthread_mutex_lock(&sc->rx_mtx); sc->rx_in_progress = 1; pci_vtnet_tap_rx(sc); sc->rx_in_progress = 0; pthread_mutex_unlock(&sc->rx_mtx); }