AP_HAL_SITL: Add missing const in member functions

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
This commit is contained in:
Patrick José Pereira 2021-02-01 13:26:28 -03:00 committed by Andrew Tridgell
parent 6899c0b5af
commit dc6f5aec92
6 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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;

View File

@ -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()) {

View File

@ -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;

View File

@ -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;

View File

@ -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;