| eRPC API Reference Rev. 1.8.1 NXP Semiconductors

- Main Page
- API Reference
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
erpc::Thread Class Reference
Porting » Threads

Simple thread class. More...

`#include <erpc_threading.h>`

## Public Types
typedef void * | thread_id_t
| Unique identifier for a thread.

## 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)
| 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)
| 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 Thread * | getCurrentThread (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

  name | Optional name for the thread.

Thread::Thread | ( | thread_entry_t | entry,
|  | uint32_t | priority = `0`,
|  | uint32_t | stackSize = `0`,
|  | const char * | name = `0`
| ) |  |

Constructor.

This constructor fully initializes the thread object.

Parameters

  entry |
  priority |
  stackSize |
  name | Optional name for the thread.

## Member Function Documentation

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

This function sets name for thread.

Parameters

  [in] | name | Name 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`
| ) |  |

This function initializes thread.

Parameters

  [in] | entry | Entry function.
  [in] | priority | Task priority.
  [in] | stackSize | Stack size.

void Thread::start | ( | void * | arg = `0` | ) |

This function starts thread execution.

Parameters

  [in] | arg | Function argument.

void Thread::sleep | ( | uint32_t | usecs | ) |
| static

This function puts thread to sleep.

Parameters

  [in] | usecs | Time for sleeping.

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 |  | ) |
| inline static

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] | o | Thread instance.

Return values

  true | When threads are same.
  false | When threads aren't same.

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

- erpc_threading.h
- erpc_threading_pthreads.cpp
- erpc_threading_win32.cpp