diff options
author | Dimitri Staessens <[email protected]> | 2021-12-22 12:14:21 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2021-12-22 16:37:41 +0100 |
commit | 0a0c244b9939059b86d304dd127763fed7d10af4 (patch) | |
tree | 7eb895ce2c8ca7d22bef688e877bc6cfa180d517 /src/lib/timerwheel.c | |
parent | 12f8f9e5ac624f120b21923c89b5aa144a70966a (diff) | |
download | ouroboros-0.18.4.tar.gz ouroboros-0.18.4.zip |
lib: Ease lock in timerwheel0.18.4
It was taking a write lock when a read lock was sufficient.
Signed-off-by: Dimitri Staessens <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/lib/timerwheel.c')
-rw-r--r-- | src/lib/timerwheel.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/timerwheel.c b/src/lib/timerwheel.c index 3c1a44b4..487dcd0e 100644 --- a/src/lib/timerwheel.c +++ b/src/lib/timerwheel.c @@ -189,7 +189,7 @@ static void timerwheel_move(void) || f->flow_id != r->flow_id) goto cleanup; - pthread_rwlock_wrlock(&r->frcti->lock); + pthread_rwlock_rdlock(&r->frcti->lock); snd_lwe = snd_cr->lwe; rcv_lwe = rcv_cr->lwe; @@ -198,7 +198,7 @@ static void timerwheel_move(void) pthread_rwlock_unlock(&r->frcti->lock); /* Has been ack'd, remove. */ - if ((int) (r->seqno - snd_lwe) < 0) + if (before(r->seqno, snd_lwe)) goto cleanup; /* Check for r-timer expiry. */ |