From fe8070bd516fe641c1cd933c6a0caba4d68ca656 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 29 Dec 2015 09:09:45 +1100 Subject: [PATCH] DataFlash: move lock to protect just buffer IO --- libraries/DataFlash/DataFlash_File.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libraries/DataFlash/DataFlash_File.cpp b/libraries/DataFlash/DataFlash_File.cpp index 13f971d7310..940db1e8f9d 100644 --- a/libraries/DataFlash/DataFlash_File.cpp +++ b/libraries/DataFlash/DataFlash_File.cpp @@ -474,16 +474,15 @@ bool DataFlash_File::WritePrioritisedBlock(const void *pBuffer, uint16_t size, b return false; } - if (!semaphore->take(1)) { - return false; - } - if (! WriteBlockCheckStartupMessages()) { _dropped++; - semaphore->give(); return false; } + if (!semaphore->take(1)) { + return false; + } + uint16_t _head; uint16_t space = BUF_SPACE(_writebuf);