From 4aa55d633e420da44de8c3b1d2bad7ff182395f5 Mon Sep 17 00:00:00 2001 From: Rob Swindell Date: Thu, 27 Aug 2020 19:03:21 -0700 Subject: [PATCH] Fix bug when queue size == 1 The initial values for a channel caused the first read to already be past the end of the queue (when the queue size is 1). This was fixed by simply changing the initial value of next_index to 0. If there is a better fix, please let me know. --- src/libach_posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libach_posix.c b/src/libach_posix.c index 0eed222..98b6f06 100644 --- a/src/libach_posix.c +++ b/src/libach_posix.c @@ -626,7 +626,7 @@ libach_open_posix( ach_channel_t *chan, const char *channel_name, chan->len = len; chan->shm = shm; chan->seq_num = 0; - chan->next_index = 1; + chan->next_index = 0; chan->cancel = 0; chan->clock = clock; }