diff options
Diffstat (limited to 'libpager')
-rw-r--r-- | libpager/seqnos.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libpager/seqnos.c b/libpager/seqnos.c index 62db626d..94cce93b 100644 --- a/libpager/seqnos.c +++ b/libpager/seqnos.c @@ -16,28 +16,31 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "priv.h" +#include <assert.h> /* The message with seqno SEQNO has just been dequeued for pager P; wait until all preceding messages have had a chance and then return. */ void _pager_wait_for_seqno (struct pager *p, - int seqno) + int seqno) { while (seqno != p->seqno + 1) { p->waitingforseqno = 1; condition_wait (&p->wakeup, &p->interlock); } - p->seqno = seqno; } /* Allow the next message for pager P (potentially blocked in _pager_wait_for_seqno) to be handled. */ void -_pager_release_seqno (struct pager *p) +_pager_release_seqno (struct pager *p, + int seqno) { + assert (seqno == p->seqno + 1); + p->seqno = seqno; if (p->waitingforseqno) { p->waitingforseqno = 0; |