DataFlash: move lock to protect just buffer IO

This commit is contained in:
Andrew Tridgell 2015-12-29 09:09:45 +11:00
parent 1a0f613a0f
commit fe8070bd51
1 changed files with 4 additions and 5 deletions

View File

@ -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);