perf_counter: use a mutex to protect concurrent access to the perf_counters linked list
perf_counter: use a mutex to protect concurrent access to the perf_counters linked list

perf_counters is read from and written to by different threads and thus
requires synchronization. Without it we risk accessing invalid memory.

There are still remaining issues (see comment in code), they will not lead
to a crash however.

jlecoeur/Firmware,mje-nz/PX4-Firmware,jlecoeur/Firmware,jlecoeur/Firmware,dagar/Firmware,krbeverx/Firmware,jlecoeur/Firmware,dagar/Firmware,dagar/Firmware,Aerotenna/Firmware,Aerotenna/Firmware,PX4/Firmware,mcgill-robotics/Firmware,PX4/Firmware,acfloria/Firmware,krbeverx/Firmware,mcgill-robotics/Firmware,PX4/Firmware,mje-nz/PX4-Firmware,mje-nz/PX4-Firmware,mcgill-robotics/Firmware,dagar/Firmware,krbeverx/Firmware,acfloria/Firmware,krbeverx/Firmware,jlecoeur/Firmware,jlecoeur/Firmware,mje-nz/PX4-Firmware,mcgill-robotics/Firmware,Aerotenna/Firmware,Aerotenna/Firmware,dagar/Firmware,mje-nz/PX4-Firmware,mcgill-robotics/Firmware,PX4/Firmware,Aerotenna/Firmware,Aerotenna/Firmware,mcgill-robotics/Firmware,PX4/Firmware,acfloria/Firmware,krbeverx/Firmware,mje-nz/PX4-Firmware,acfloria/Firmware,PX4/Firmware,mcgill-robotics/Firmware,acfloria/Firmware,dagar/Firmware,dagar/Firmware,acfloria/Firmware,krbeverx/Firmware,acfloria/Firmware,jlecoeur/Firmware,jlecoeur/Firmware,PX4/Firmware,Aerotenna/Firmware,krbeverx/Firmware,mje-nz/PX4-Firmware