Make Thread methods const

pull/7872/head
Kevin Bracey 2018-08-23 15:14:20 +03:00
parent 1330eeecd0
commit 0ddd1d9af5
2 changed files with 15 additions and 15 deletions

View File

@ -178,7 +178,7 @@ osStatus Thread::set_priority(osPriority priority)
return ret;
}
osPriority Thread::get_priority()
osPriority Thread::get_priority() const
{
osPriority_t ret;
_mutex.lock();
@ -201,7 +201,7 @@ int32_t Thread::signal_set(int32_t flags)
return osThreadFlagsSet(_tid, flags);
}
Thread::State Thread::get_state()
Thread::State Thread::get_state() const
{
uint8_t state = osThreadTerminated;
@ -267,7 +267,7 @@ Thread::State Thread::get_state()
return user_state;
}
uint32_t Thread::stack_size()
uint32_t Thread::stack_size() const
{
uint32_t size = 0;
_mutex.lock();
@ -280,7 +280,7 @@ uint32_t Thread::stack_size()
return size;
}
uint32_t Thread::free_stack()
uint32_t Thread::free_stack() const
{
uint32_t size = 0;
_mutex.lock();
@ -296,7 +296,7 @@ uint32_t Thread::free_stack()
return size;
}
uint32_t Thread::used_stack()
uint32_t Thread::used_stack() const
{
uint32_t size = 0;
_mutex.lock();
@ -312,7 +312,7 @@ uint32_t Thread::used_stack()
return size;
}
uint32_t Thread::max_stack()
uint32_t Thread::max_stack() const
{
uint32_t size = 0;
_mutex.lock();
@ -334,7 +334,7 @@ uint32_t Thread::max_stack()
return size;
}
const char *Thread::get_name()
const char *Thread::get_name() const
{
return _attr.name;
}

View File

@ -305,7 +305,7 @@ public:
@note You cannot call this function from ISR context.
*/
osPriority get_priority();
osPriority get_priority() const;
/** Set the specified Thread Flags for the thread.
@param flags specifies the flags of the thread that should be set.
@ -356,42 +356,42 @@ public:
@note You cannot call this function from ISR context.
*/
State get_state();
State get_state() const;
/** Get the total stack memory size for this Thread
@return the total stack memory size in bytes
@note You cannot call this function from ISR context.
*/
uint32_t stack_size();
uint32_t stack_size() const;
/** Get the currently unused stack memory for this Thread
@return the currently unused stack memory in bytes
@note You cannot call this function from ISR context.
*/
uint32_t free_stack();
uint32_t free_stack() const;
/** Get the currently used stack memory for this Thread
@return the currently used stack memory in bytes
@note You cannot call this function from ISR context.
*/
uint32_t used_stack();
uint32_t used_stack() const;
/** Get the maximum stack memory usage to date for this Thread
@return the maximum stack memory usage to date in bytes
@note You cannot call this function from ISR context.
*/
uint32_t max_stack();
uint32_t max_stack() const;
/** Get thread name
@return thread name or NULL if the name was not set.
@note You may call this function from ISR context.
*/
const char *get_name();
const char *get_name() const;
/** Get thread id
@return thread ID for reference by other functions.
@ -536,7 +536,7 @@ private:
osThreadAttr_t _attr;
bool _dynamic_stack;
Semaphore _join_sem;
Mutex _mutex;
mutable Mutex _mutex;
mbed_rtos_storage_thread_t _obj_mem;
bool _finished;
};