eRPC API Reference  Rev. 1.12.0
NXP Semiconductors
erpc::Thread Class Reference

Simple thread class. More...

#include <erpc_threading.h>

Public Types

typedef void * thread_id_t
 Unique identifier for a thread.
 
typedef void * thread_stack_pointer
 

Public Member Functions

 Thread (const char *name=0)
 Default constructor for use with the init() method. More...
 
 Thread (thread_entry_t entry, uint32_t priority=0, uint32_t stackSize=0, const char *name=0, thread_stack_pointer stackPtr=NULL)
 Constructor. More...
 
virtual ~Thread (void)
 Destructor.
 
void setName (const char *name)
 This function sets name for thread. More...
 
const char * getName (void) const
 This function returns name of thread. More...
 
void init (thread_entry_t entry, uint32_t priority=0, uint32_t stackSize=0, thread_stack_pointer stackPtr=NULL)
 This function initializes thread. More...
 
void start (void *arg=0)
 This function starts thread execution. More...
 
thread_id_t getThreadId (void) const
 This function returns current thread id. More...
 
bool operator== (Thread &o)
 Compare operator compares two threads. More...
 

Static Public Member Functions

static void sleep (uint32_t usecs)
 This function puts thread to sleep. More...
 
static thread_id_t getCurrentThreadId (void)
 This function returns thread id where function is called. More...
 
static ThreadgetCurrentThread (void)
 This function returns Thread instance where functions is called. More...
 

Protected Member Functions

virtual void threadEntryPoint (void)
 This function execute entry function.
 

Detailed Description

Simple thread class.

Constructor & Destructor Documentation

Thread::Thread ( const char *  name = 0)

Default constructor for use with the init() method.

If this constructor is used, the init() method must be called before the thread can be started.

Parameters
[in]nameOptional name for the thread.
Thread::Thread ( thread_entry_t  entry,
uint32_t  priority = 0,
uint32_t  stackSize = 0,
const char *  name = 0,
thread_stack_pointer  stackPtr = NULL 
)

Constructor.

This constructor fully initializes the thread object.

Parameters
[in]entry
[in]priority
[in]stackSize
[in]nameOptional name for the thread.
[in]stackPtrMandatory task stack pointer for static api usage.

Member Function Documentation

void erpc::Thread::setName ( const char *  name)
inline

This function sets name for thread.

Parameters
[in]nameName for thread.
const char* erpc::Thread::getName ( void  ) const
inline

This function returns name of thread.

Returns
Name of thread.
void Thread::init ( thread_entry_t  entry,
uint32_t  priority = 0,
uint32_t  stackSize = 0,
thread_stack_pointer  stackPtr = NULL 
)

This function initializes thread.

Parameters
[in]entryEntry function.
[in]priorityTask priority.
[in]stackSizeStack size.
[in]stackPtrMandatory task stack pointer for static api usage.
void Thread::start ( void *  arg = 0)

This function starts thread execution.

Parameters
[in]argFunction argument.
void Thread::sleep ( uint32_t  usecs)
static

This function puts thread to sleep.

Parameters
[in]usecsTime for sleeping in [us].
thread_id_t erpc::Thread::getThreadId ( void  ) const
inline

This function returns current thread id.

Returns
Thread id.
static thread_id_t erpc::Thread::getCurrentThreadId ( void  )
inlinestatic

This function returns thread id where function is called.

Returns
Thread id.
Thread * Thread::getCurrentThread ( void  )
static

This function returns Thread instance where functions is called.

Returns
Thread instance.
bool Thread::operator== ( Thread o)

Compare operator compares two threads.

Parameters
[in]oThread instance.
Return values
trueWhen threads are same.
falseWhen threads aren't same.

The documentation for this class was generated from the following files: