Browse Source

AP_HAL_SITL: Add missing const in member functions

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
zr-v5.1
Patrick José Pereira 4 years ago committed by Andrew Tridgell
parent
commit
dc6f5aec92
  1. 2
      libraries/AP_HAL_SITL/Scheduler.cpp
  2. 4
      libraries/AP_HAL_SITL/Scheduler.h
  3. 2
      libraries/AP_HAL_SITL/Semaphores.cpp
  4. 2
      libraries/AP_HAL_SITL/Semaphores.h
  5. 2
      libraries/AP_HAL_SITL/UARTDriver.h
  6. 2
      libraries/AP_HAL_SITL/UART_utils.cpp

2
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 * time (due to the logic in SITL_State::wait_clock) and thus taking
* the semaphore never times out - meaning we essentially deadlock. * 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) { if (pthread_self() != _main_ctx) {
// only the main thread ever moves stuff forwards // only the main thread ever moves stuff forwards

4
libraries/AP_HAL_SITL/Scheduler.h

@ -33,7 +33,7 @@ public:
void reboot(bool hold_in_bootloader) override; void reboot(bool hold_in_bootloader) override;
bool interrupts_are_blocked(void) { bool interrupts_are_blocked(void) const {
return _nested_atomic_ctr != 0; return _nested_atomic_ctr != 0;
} }
@ -66,7 +66,7 @@ public:
* threads. * threads.
*/ */
// a couple of helper functions to cope with SITL's time stepping // a couple of helper functions to cope with SITL's time stepping
bool semaphore_wait_hack_required(); bool semaphore_wait_hack_required() const;
private: private:
SITL_State *_sitlState; SITL_State *_sitlState;

2
libraries/AP_HAL_SITL/Semaphores.cpp

@ -31,7 +31,7 @@ bool Semaphore::give()
return true; return true;
} }
void Semaphore::check_owner() void Semaphore::check_owner() const
{ {
// should probably make sure we're holding the semaphore here.... // should probably make sure we're holding the semaphore here....
if (owner != pthread_self()) { if (owner != pthread_self()) {

2
libraries/AP_HAL_SITL/Semaphores.h

@ -14,7 +14,7 @@ public:
bool take(uint32_t timeout_ms) override; bool take(uint32_t timeout_ms) override;
bool take_nonblocking() 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: protected:
pthread_mutex_t _lock; pthread_mutex_t _lock;

2
libraries/AP_HAL_SITL/UARTDriver.h

@ -117,7 +117,7 @@ private:
void _check_connection(void); void _check_connection(void);
static bool _select_check(int ); static bool _select_check(int );
static void _set_nonblocking(int ); static void _set_nonblocking(int );
bool set_speed(int speed); bool set_speed(int speed) const;
SITL_State *_sitlState; SITL_State *_sitlState;
uint64_t _receive_timestamp; uint64_t _receive_timestamp;

2
libraries/AP_HAL_SITL/UART_utils.cpp

@ -35,7 +35,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
bool HALSITL::UARTDriver::set_speed(int speed) bool HALSITL::UARTDriver::set_speed(int speed) const
{ {
if (_fd < 0) { if (_fd < 0) {
return false; return false;

Loading…
Cancel
Save