diff --git a/libraries/AP_HAL_SITL/Scheduler.cpp b/libraries/AP_HAL_SITL/Scheduler.cpp index 348d8118f9..941648432d 100644 --- a/libraries/AP_HAL_SITL/Scheduler.cpp +++ b/libraries/AP_HAL_SITL/Scheduler.cpp @@ -73,7 +73,7 @@ bool Scheduler::in_main_thread() const * time (due to the logic in SITL_State::wait_clock) and thus taking * the semaphore never times out - meaning we essentially deadlock. */ -bool Scheduler::semaphore_wait_hack_required() +bool Scheduler::semaphore_wait_hack_required() const { if (pthread_self() != _main_ctx) { // only the main thread ever moves stuff forwards diff --git a/libraries/AP_HAL_SITL/Scheduler.h b/libraries/AP_HAL_SITL/Scheduler.h index a6bbb84a65..94fd7d3c81 100644 --- a/libraries/AP_HAL_SITL/Scheduler.h +++ b/libraries/AP_HAL_SITL/Scheduler.h @@ -33,7 +33,7 @@ public: void reboot(bool hold_in_bootloader) override; - bool interrupts_are_blocked(void) { + bool interrupts_are_blocked(void) const { return _nested_atomic_ctr != 0; } @@ -66,7 +66,7 @@ public: * threads. */ // a couple of helper functions to cope with SITL's time stepping - bool semaphore_wait_hack_required(); + bool semaphore_wait_hack_required() const; private: SITL_State *_sitlState; diff --git a/libraries/AP_HAL_SITL/Semaphores.cpp b/libraries/AP_HAL_SITL/Semaphores.cpp index 3bd22e9500..216c1d98ee 100644 --- a/libraries/AP_HAL_SITL/Semaphores.cpp +++ b/libraries/AP_HAL_SITL/Semaphores.cpp @@ -31,7 +31,7 @@ bool Semaphore::give() return true; } -void Semaphore::check_owner() +void Semaphore::check_owner() const { // should probably make sure we're holding the semaphore here.... if (owner != pthread_self()) { diff --git a/libraries/AP_HAL_SITL/Semaphores.h b/libraries/AP_HAL_SITL/Semaphores.h index 75abb612e4..63aa57f2f5 100644 --- a/libraries/AP_HAL_SITL/Semaphores.h +++ b/libraries/AP_HAL_SITL/Semaphores.h @@ -14,7 +14,7 @@ public: bool take(uint32_t timeout_ms) override; bool take_nonblocking() override; - void check_owner(); // asserts that current thread owns semaphore + void check_owner() const; // asserts that current thread owns semaphore protected: pthread_mutex_t _lock; diff --git a/libraries/AP_HAL_SITL/UARTDriver.h b/libraries/AP_HAL_SITL/UARTDriver.h index 62a5b1b118..59053da486 100644 --- a/libraries/AP_HAL_SITL/UARTDriver.h +++ b/libraries/AP_HAL_SITL/UARTDriver.h @@ -117,7 +117,7 @@ private: void _check_connection(void); static bool _select_check(int ); static void _set_nonblocking(int ); - bool set_speed(int speed); + bool set_speed(int speed) const; SITL_State *_sitlState; uint64_t _receive_timestamp; diff --git a/libraries/AP_HAL_SITL/UART_utils.cpp b/libraries/AP_HAL_SITL/UART_utils.cpp index 9739d6101e..f0a7d06c70 100644 --- a/libraries/AP_HAL_SITL/UART_utils.cpp +++ b/libraries/AP_HAL_SITL/UART_utils.cpp @@ -35,7 +35,7 @@ #include #include -bool HALSITL::UARTDriver::set_speed(int speed) +bool HALSITL::UARTDriver::set_speed(int speed) const { if (_fd < 0) { return false;