LCOV - code coverage report
Current view: top level - AP_HAL - Semaphores.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 15 15 100.0 %
Date: 2026-09-09 11:02:08 Functions: 3 3 100.0 %

          Line data    Source code
       1             : #include "AP_HAL.h"
       2             : 
       3             : extern const AP_HAL::HAL &hal;
       4             : 
       5             : /*
       6             :   implement WithSemaphore class for WITH_SEMAPHORE() support
       7             :  */
       8      214747 : WithSemaphore::WithSemaphore(AP_HAL::Semaphore *mtx, uint32_t line) :
       9      214747 :     WithSemaphore(*mtx, line)
      10      214747 : {}
      11             : 
      12  4991343080 : WithSemaphore::WithSemaphore(AP_HAL::Semaphore &mtx, uint32_t line) :
      13  4991343080 :     _mtx(mtx)
      14             : {
      15             : #ifndef HAL_BOOTLOADER_BUILD
      16  4991343080 :     bool in_main = hal.scheduler->in_main_thread();
      17  4991313279 :     if (in_main) {
      18  3675441781 :         hal.util->persistent_data.semaphore_line = line;
      19             :     }
      20             : #endif
      21  4991313279 :     _mtx.take_blocking();
      22             : #ifndef HAL_BOOTLOADER_BUILD
      23  4991323303 :     if (in_main) {
      24  3675441781 :         hal.util->persistent_data.semaphore_line = 0;
      25             :     }
      26             : #endif
      27  4991323303 : }
      28             : 
      29  4991320687 : WithSemaphore::~WithSemaphore()
      30             : {
      31  4991320687 :     _mtx.give();
      32  4991361060 : }

Generated by: LCOV version 1.14