X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_vhost%2Ffd_man.c;h=55d4856f9ea95a70ae550d8a5ebef7b021533e4a;hb=baf023a8edfa70122c96eefa59a8bbd940d034bc;hp=b24c27dd70da223e1c87d7002c32f0743fc1c835;hpb=8b4b949144b80cc7312bbc189d38a3feaf2c74e5;p=dpdk.git diff --git a/lib/librte_vhost/fd_man.c b/lib/librte_vhost/fd_man.c index b24c27dd70..55d4856f9e 100644 --- a/lib/librte_vhost/fd_man.c +++ b/lib/librte_vhost/fd_man.c @@ -129,7 +129,9 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat) pthread_mutex_lock(&pfdset->fd_mutex); i = pfdset->num < MAX_FDS ? pfdset->num++ : -1; if (i == -1) { + pthread_mutex_lock(&pfdset->fd_pooling_mutex); fdset_shrink_nolock(pfdset); + pthread_mutex_unlock(&pfdset->fd_pooling_mutex); i = pfdset->num < MAX_FDS ? pfdset->num++ : -1; if (i == -1) { pthread_mutex_unlock(&pfdset->fd_mutex); @@ -246,7 +248,9 @@ fdset_event_dispatch(void *arg) numfds = pfdset->num; pthread_mutex_unlock(&pfdset->fd_mutex); + pthread_mutex_lock(&pfdset->fd_pooling_mutex); val = poll(pfdset->rwfds, numfds, 1000 /* millisecs */); + pthread_mutex_unlock(&pfdset->fd_pooling_mutex); if (val < 0) continue; @@ -293,7 +297,7 @@ fdset_event_dispatch(void *arg) * because the fd is closed in the cb, * the old fd val could be reused by when creates new * listen fd in another thread, we couldn't call - * fd_set_del. + * fdset_del. */ if (remove1 || remove2) { pfdentry->fd = -1;