This class provides a threading API.
More...
#include <OS.hxx>
|
| | OSThread (const char *name, int priority, size_t stack_size, void *(*start_routine)(void *), void *arg) |
| | Create a thread.
|
| |
| | OSThread () |
| | Creates a thread via inheritance.
|
| |
| void | start (const char *name, int priority, size_t stack_size) |
| | Starts the thread.
|
| |
| virtual | ~OSThread () |
| | Default destructor.
|
| |
| bool | is_created () |
| |
| void | inherit () |
| | Inherits the current thread.
|
| |
| os_thread_t | get_handle () |
| |
| void | lock_to_thread () |
| | Sets the thread handle to the current calling thread's.
|
| |
| void | unlock_from_thread () |
| | Resets the thread handle to none.
|
| |
|
| virtual void * | entry () |
| | User entry point for the created thread.
|
| |
|
| static void * | start (void *arg) |
| | Starting point for a new thread.
|
| |
|
| os_thread_t | handle |
| | Private thread handle.
|
| |
This class provides a threading API.
Definition at line 45 of file OS.hxx.
◆ OSThread() [1/2]
| OSThread::OSThread |
( |
const char * |
name, |
|
|
int |
priority, |
|
|
size_t |
stack_size, |
|
|
void *(*)(void *) |
start_routine, |
|
|
void * |
arg |
|
) |
| |
|
inline |
Create a thread.
- Parameters
-
| name | name of thread, NULL for an auto generated name |
| priority | priority of created thread, 0 means default, lower numbers means lower priority, higher numbers mean higher priority |
| stack_size | size in bytes of the created thread's stack |
| start_routine | entry point of the thread |
| arg | entry parameter to the thread |
Definition at line 57 of file OS.hxx.
◆ OSThread() [2/2]
Creates a thread via inheritance.
The user must overload the entry() function and call the start() method whenever convenient.
Definition at line 65 of file OS.hxx.
◆ ~OSThread()
| virtual OSThread::~OSThread |
( |
| ) |
|
|
inlinevirtual |
Default destructor.
Definition at line 85 of file OS.hxx.
◆ entry()
| virtual void * OSThread::entry |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ get_handle()
| os_thread_t OSThread::get_handle |
( |
| ) |
|
|
inline |
- Returns
- the thread handle for os_xxx operations.
Definition at line 138 of file OS.hxx.
◆ get_priority()
| static int OSThread::get_priority |
( |
OSThread * |
thread | ) |
|
|
inlinestatic |
Return the current thread priority.
- Parameters
-
| thread | handle to thread of interest |
- Returns
- current thread priority
Definition at line 116 of file OS.hxx.
◆ get_priority_max()
| static int OSThread::get_priority_max |
( |
| ) |
|
|
inlinestatic |
Get the maximum thread priority.
- Returns
- maximum trhead priority
Definition at line 132 of file OS.hxx.
◆ get_priority_min()
| static int OSThread::get_priority_min |
( |
| ) |
|
|
inlinestatic |
Get the minimum thread priority.
- Returns
- minimum trhead priority
Definition at line 124 of file OS.hxx.
◆ getpriority()
| static int OSThread::getpriority |
( |
OSThread * |
thread | ) |
|
|
inlinestatic |
Return the current thread priority.
Depricated, use get_priority().
- Parameters
-
| thread | handle to thread of interest |
- Returns
- current thread priority
Definition at line 107 of file OS.hxx.
◆ inherit()
| void OSThread::inherit |
( |
| ) |
|
|
inline |
Inherits the current thread.
Definition at line 96 of file OS.hxx.
◆ is_created()
| bool OSThread::is_created |
( |
| ) |
|
|
inline |
- Returns
- true if a thread was already created.
Definition at line 90 of file OS.hxx.
◆ lock_to_thread()
| void OSThread::lock_to_thread |
( |
| ) |
|
|
inline |
Sets the thread handle to the current calling thread's.
Needed for multiplexing environments like Arduino.
Definition at line 145 of file OS.hxx.
◆ start() [1/2]
| void OSThread::start |
( |
const char * |
name, |
|
|
int |
priority, |
|
|
size_t |
stack_size |
|
) |
| |
|
inline |
Starts the thread.
This call can be used when OSThread is inherited and there is a virtual entry point.
- Parameters
-
| name | name of thread, NULL for an auto generated name |
| priority | priority of created thread, 0 means default, lower numbers means lower priority, higher numbers mean higher priority |
| stack_size | size in bytes of the created thread's stack |
Definition at line 78 of file OS.hxx.
◆ start() [2/2]
| static void * OSThread::start |
( |
void * |
arg | ) |
|
|
inlinestaticprivate |
Starting point for a new thread.
- Parameters
-
- Returns
- exit status
Definition at line 191 of file OS.hxx.
◆ unlock_from_thread()
| void OSThread::unlock_from_thread |
( |
| ) |
|
|
inline |
Resets the thread handle to none.
Definition at line 152 of file OS.hxx.
◆ handle
| os_thread_t OSThread::handle |
|
private |
Private thread handle.
Definition at line 200 of file OS.hxx.
The documentation for this class was generated from the following file: