mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
AP_Logger: add a semaphore to protect creation of new log formats
This commit is contained in:
parent
184b3e1d63
commit
43c99664b0
@ -855,6 +855,8 @@ void AP_Logger::assert_same_fmt_for_name(const AP_Logger::log_write_fmt *f,
|
|||||||
|
|
||||||
AP_Logger::log_write_fmt *AP_Logger::msg_fmt_for_name(const char *name, const char *labels, const char *units, const char *mults, const char *fmt)
|
AP_Logger::log_write_fmt *AP_Logger::msg_fmt_for_name(const char *name, const char *labels, const char *units, const char *mults, const char *fmt)
|
||||||
{
|
{
|
||||||
|
WITH_SEMAPHORE(log_write_fmts_sem);
|
||||||
|
|
||||||
struct log_write_fmt *f;
|
struct log_write_fmt *f;
|
||||||
for (f = log_write_fmts; f; f=f->next) {
|
for (f = log_write_fmts; f; f=f->next) {
|
||||||
if (f->name == name) { // ptr comparison
|
if (f->name == name) { // ptr comparison
|
||||||
|
@ -413,6 +413,7 @@ private:
|
|||||||
const char *units;
|
const char *units;
|
||||||
const char *mults;
|
const char *mults;
|
||||||
} *log_write_fmts;
|
} *log_write_fmts;
|
||||||
|
HAL_Semaphore_Recursive log_write_fmts_sem;
|
||||||
|
|
||||||
// return (possibly allocating) a log_write_fmt for a name
|
// return (possibly allocating) a log_write_fmt for a name
|
||||||
struct log_write_fmt *msg_fmt_for_name(const char *name, const char *labels, const char *units, const char *mults, const char *fmt);
|
struct log_write_fmt *msg_fmt_for_name(const char *name, const char *labels, const char *units, const char *mults, const char *fmt);
|
||||||
|
Loading…
Reference in New Issue
Block a user