From 4f7da4812e767780a1e63cb0ed77778bc46d4270 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Fri, 27 Dec 2019 09:24:51 +0900 Subject: [PATCH] chopstx_poll: More change. Signed-off-by: NIIBE Yutaka --- chopstx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chopstx.c b/chopstx.c index cfe1069..15f0a5e 100644 --- a/chopstx.c +++ b/chopstx.c @@ -1491,11 +1491,7 @@ chx_proxy_init (struct chx_px *px, uint32_t *cp) * should be one of: * chopstx_poll_cond_t, chopstx_poll_join_t, or chopstx_intr_t. * - * Returns number of active descriptors. Don't assume no active - * descriptors means timeout. It is possible for chopstx_poll to - * return zero (but not because of timeout), when it's woken up but - * found no condition matches. Application should call chopstx_poll - * again in this situation. + * Returns number of active descriptors. */ int chopstx_poll (uint32_t *usec_p, int n, struct chx_poll_head *const pd_array[]) @@ -1513,6 +1509,7 @@ chopstx_poll (uint32_t *usec_p, int n, struct chx_poll_head *const pd_array[]) for (i = 0; i < n; i++) chx_proxy_init (&px[i], &counter); + again: for (i = 0; i < n; i++) { pd = pd_array[i]; @@ -1620,6 +1617,9 @@ chopstx_poll (uint32_t *usec_p, int n, struct chx_poll_head *const pd_array[]) if (r < 0) chopstx_exit (CHOPSTX_CANCELED); + if (counter == 0 && (usec_p == NULL || *usec_p)) + goto again; + return counter; }