diff options
Diffstat (limited to 'lib/librte_vhost/fd_man.c')
-rw-r--r-- | lib/librte_vhost/fd_man.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/librte_vhost/fd_man.c b/lib/librte_vhost/fd_man.c index 38347ab1..55d4856f 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; |