Argon RTOS  1.3.0
Tiny embedded real-time kernel
Ar::ThreadWithStack< S > Class Template Reference

#include <ar_classes.h>

+ Inheritance diagram for Ar::ThreadWithStack< S >:

Description

template<uint32_t S>
class Ar::ThreadWithStack< S >

Template to create a thread and its stack.

+ Collaboration diagram for Ar::ThreadWithStack< S >:

Public Member Functions

 ThreadWithStack ()
 Default constructor.
 
 ThreadWithStack (const char *name, ar_thread_entry_t entry, void *param, uint8_t priority, bool startImmediately=true)
 Constructor to use a normal function as entry poin.
 
template<class T >
 ThreadWithStack (const char *name, T *object, void(T::*entry)(), uint8_t priority, bool startImmediately=true)
 Constructor to set the thread entry to a member function.
 
ar_status_t init (const char *name, ar_thread_entry_t entry, void *param, uint8_t priority, bool startImmediately=true)
 Initializer to use a normal function as entry point.
 
template<class T >
ar_status_t init (const char *name, T *object, void(T::*entry)(), uint8_t priority, bool startImmediately=true)
 Initializer to set the thread entry to a member function.
 
- Public Member Functions inherited from Ar::Thread
 Thread ()
 Default constructor.
 
 Thread (const char *name, ar_thread_entry_t entry, void *param, void *stack, unsigned stackSize, uint8_t priority, bool startImmediately=true)
 Constructor. More...
 
template<class T >
 Thread (const char *name, T *object, void(T::*entry)(), void *stack, unsigned stackSize, uint8_t priority, bool startImmediately=true)
 Constructor to set the thread entry to a member function. More...
 
 Thread (const char *name, ar_thread_entry_t entry, void *param, unsigned stackSize, uint8_t priority, bool startImmediately=true)
 Constructor to dynamically allocate the stack. More...
 
template<class T >
 Thread (const char *name, T *object, void(T::*entry)(), unsigned stackSize, uint8_t priority, bool startImmediately=true)
 Constructor to set the thread entry to a member function, using a dynamic stack. More...
 
virtual ~Thread ()
 Destructor.
 
const char * getName () const
 Get the thread's name.
 
ar_status_t init (const char *name, ar_thread_entry_t entry, void *param, void *stack, unsigned stackSize, uint8_t priority, bool startImmediately=true)
 Base initialiser. More...
 
template<class T >
ar_status_t init (const char *name, T *object, void(T::*entry)(), void *stack, unsigned stackSize, uint8_t priority, bool startImmediately=true)
 Initializer to set the thread entry to a member function. More...
 
uint8_t getPriority () const
 Return the thread's current priority.
 
ar_status_t setPriority (uint8_t priority)
 Change the thread's priority. More...
 
uint32_t getLoad ()
 Get the thread's system load.
 
uint32_t getStackUsed ()
 Get the thread's maximum stack usage.
 
void suspend ()
 Put thread in suspended state. More...
 
void resume ()
 Make the thread eligible for execution. More...
 
ar_thread_state_t getState () const
 Return the current state of the thread.
 
- Public Member Functions inherited from ar_thread_t
void block (ar_list_t &blockedList, uint32_t timeout)
 
void unblockWithStatus (ar_list_t &blockedList, ar_status_t unblockStatus)
 

Protected Attributes

uint8_t m_stack [S]
 Stack space for the thread.
 
- Protected Attributes inherited from Ar::Thread
uint8_t * m_allocatedStack
 Dynamically allocated stack.
 
ar_thread_entry_t m_userEntry
 User-specified thread entry point function.
 

Additional Inherited Members

- Static Public Member Functions inherited from Ar::Thread
static ThreadgetCurrent ()
 Returns the currently running thread object.
 
static void sleep (unsigned milliseconds)
 Put the current thread to sleep for a certain amount of time. More...
 
static void sleepUntil (unsigned wakeup)
 Put the current thread to sleep until a specific time. More...
 
- Public Attributes inherited from ar_thread_t
ar_list_node_t m_blockedNode
 Blocked list node.
 
void * m_channelData
 Receive or send data pointer for blocked channel.
 
ar_thread_entry_t m_entry
 Function pointer for the thread's entry point.
 
const char * m_name
 Thread name.
 
ar_thread_port_data_t m_portData
 Port-specific thread data.
 
uint8_t m_priority
 Thread priority. 0 is the lowest priority.
 
ar_runloop_t * m_runLoop
 Run loop associated with this thread.
 
uint32_t * m_stackBottom
 Beginning of stack.
 
volatile uint8_t * m_stackPointer
 Current stack pointer.
 
uint32_t * m_stackTop
 Saved stack top address for computing stack usage.
 
ar_thread_state_t m_state
 Current thread state.
 
ar_list_node_t m_threadNode
 Main thread list node.
 
ar_status_t m_unblockStatus
 Status code to return from a blocking function upon unblocking.
 
uint32_t m_uniqueId
 Unique ID for this thread.
 
uint32_t m_wakeupTime
 Tick count when a sleeping thread will awaken.
 
- Protected Member Functions inherited from Ar::Thread
ar_status_t initForMemberFunction (const char *name, void *object, ar_thread_entry_t entry, void *memberPointer, uint32_t memberPointerSize, void *stack, unsigned stackSize, uint8_t priority, bool startImmediately)
 Special init method to deal with member functions.
 
virtual void threadEntry (void *param)
 Virtual thread entry point. More...
 
- Static Protected Member Functions inherited from Ar::Thread
template<class T >
static void member_thread_entry (void *param)
 Template function to invoke a thread entry point that is a member function.
 
static void thread_entry (void *param)
 Static thread entry callback to invoke the virtual method.