chopstx_poll: More change.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka
2019-12-27 09:24:51 +09:00
parent 50a5951422
commit 4f7da4812e

View File

@@ -1491,11 +1491,7 @@ chx_proxy_init (struct chx_px *px, uint32_t *cp)
* should be one of: * should be one of:
* chopstx_poll_cond_t, chopstx_poll_join_t, or chopstx_intr_t. * chopstx_poll_cond_t, chopstx_poll_join_t, or chopstx_intr_t.
* *
* Returns number of active descriptors. Don't assume no active * Returns number of active descriptors.
* 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.
*/ */
int int
chopstx_poll (uint32_t *usec_p, int n, struct chx_poll_head *const pd_array[]) 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++) for (i = 0; i < n; i++)
chx_proxy_init (&px[i], &counter); chx_proxy_init (&px[i], &counter);
again:
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
pd = pd_array[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) if (r < 0)
chopstx_exit (CHOPSTX_CANCELED); chopstx_exit (CHOPSTX_CANCELED);
if (counter == 0 && (usec_p == NULL || *usec_p))
goto again;
return counter; return counter;
} }