Browse Source

AP_Logger: only write final log out a page at a time to avoid lock contention

remove health check timing hack
c415-sdk
Andy Piper 4 years ago committed by Andrew Tridgell
parent
commit
dc0084a2b2
  1. 16
      libraries/AP_Logger/AP_Logger_Block.cpp

16
libraries/AP_Logger/AP_Logger_Block.cpp

@ -824,10 +824,8 @@ bool AP_Logger_Block::logging_failed() const
bool AP_Logger_Block::io_thread_alive() const bool AP_Logger_Block::io_thread_alive() const
{ {
// if the io thread hasn't had a heartbeat in 5s it is dead // if the io thread hasn't had a heartbeat in 1s it is dead
// the timeout is longer than might be otherwise required to allow for the FFT running return (AP_HAL::millis() - io_timer_heartbeat) < 1000U;
// at the same priority
return (AP_HAL::millis() - io_timer_heartbeat) < 5000U;
} }
/* /*
@ -896,12 +894,13 @@ void AP_Logger_Block::io_timer(void)
log_write_started = false; log_write_started = false;
// complete writing any previous log // complete writing any previous log, a page at a time to avoid holding the lock for too long
while (writebuf.available()) { if (writebuf.available()) {
write_log_page(); write_log_page();
} else {
writebuf.clear();
stop_log_pending = false;
} }
writebuf.clear();
stop_log_pending = false;
// write at most one page // write at most one page
} else if (writebuf.available() >= df_PageSize - sizeof(struct PageHeader)) { } else if (writebuf.available() >= df_PageSize - sizeof(struct PageHeader)) {
@ -909,7 +908,6 @@ void AP_Logger_Block::io_timer(void)
write_log_page(); write_log_page();
} }
} }
// write out a page of log data // write out a page of log data

Loading…
Cancel
Save