From 1006b642e78c2911450b5f3910e9aba50cde4802 Mon Sep 17 00:00:00 2001 From: skarg Date: Mon, 9 Jan 2012 23:16:53 +0000 Subject: [PATCH] I was thinking that this might need to be done to separate the head from tail in case head is incremented by ISR while this is called. --- bacnet-stack/src/fifo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bacnet-stack/src/fifo.c b/bacnet-stack/src/fifo.c index 5a95d949..a67ea65f 100755 --- a/bacnet-stack/src/fifo.c +++ b/bacnet-stack/src/fifo.c @@ -194,8 +194,11 @@ bool FIFO_Add( void FIFO_Flush( FIFO_BUFFER * b) { + unsigned head; /* used to avoid volatile decision */ + if (b) { - b->tail = b->head; + head = b->head; + b->tail = head; } }