#include <Thread.hh>
The Cosa Nucleo Thread; run-to-completion multi-tasking.
Definition at line 33 of file Thread.hh.
void Linkage::attach |
( |
Linkage * |
pred | ) |
|
|
inlineinherited |
Attach given linkage as predecessor. Will check and detach if already attached.
- Parameters
-
[in] | pred | linkage to attach. |
- Note
- atomic
Definition at line 71 of file Linkage.hh.
void Thread::begin |
( |
Thread * |
thread = NULL , |
|
|
size_t |
size = 0 |
|
) |
| |
|
static |
Schedule static thread with given stack size. Using the default parameters will start the main thread.
- Parameters
-
[in] | thread | to initiate and schedule. |
[in] | size | of stack. |
Definition at line 57 of file Thread.cpp.
void Thread::delay |
( |
uint32_t |
ms | ) |
|
Delay at least the given time period in milli-seconds. The resolution is determined by the Watchdog clock and has a resolution of 16 milli-seconds (per tick). The actual delay also depends on how other threads yield.
- Parameters
-
[in] | ms | minimum delay time period in milli-seconds. |
Definition at line 121 of file Thread.cpp.
void Thread::dequeue |
( |
Head * |
queue, |
|
|
bool |
flag = true |
|
) |
| |
If given queue is not empty dequeue first thread and resume direct if flag is true otherwise enqueue first in run queue.
- Parameters
-
[in] | queue | to transfer from. |
[in] | flag | resume direct otherwise on yield (Default true). |
Definition at line 107 of file Thread.cpp.
Detach this link. Unlink from any list.
Definition at line 125 of file Linkage.hh.
Enqueue running thread to given queue and yield.
- Parameters
-
[in] | queue | to transfer to. |
[in] | thread | to resume (Default yield). |
Definition at line 98 of file Thread.cpp.
void Thread::init |
( |
void * |
stack | ) |
|
|
protected |
Initiate thread and prepare for initial call to virtual member function run(). Stack frame is allocated by begin().
- Parameters
-
Definition at line 49 of file Thread.cpp.
virtual void Event::Handler::on_event |
( |
uint8_t |
type, |
|
|
uint16_t |
value |
|
) |
| |
|
inlinevirtualinherited |
Return predecessor in sequence.
- Returns
- predecessor linkage.
Definition at line 60 of file Linkage.hh.
void Thread::resume |
( |
Thread * |
thread | ) |
|
Yield control to the given thread. Preserve stack and machine state and later continue.
- Parameters
-
Definition at line 90 of file Thread.cpp.
The thread main function. The function is called when the thread is scheduled and becomes running. Normally the function is an end-less loop. Returning from the function will result in that the function is called again. The default implementation is the main thread. It is responsible for power down when there are no other active threads. Other threads must override this member function.
Definition at line 72 of file Thread.cpp.
static Thread* Nucleo::Thread::running |
( |
| ) |
|
|
inlinestatic |
Return running thread.
- Returns
- thread.
Definition at line 39 of file Thread.hh.
Service the nucleos main thread. Should be called in the loop() function.
Definition at line 133 of file Thread.cpp.
Return successor in sequence.
- Returns
- successor linkage.
Definition at line 51 of file Linkage.hh.
void Nucleo::Thread::yield |
( |
| ) |
|
|
inline |
Yield control to the next thread in the thread queue. Preserve stack and machine state and later continue.
Definition at line 75 of file Thread.hh.
Allow friends to use the queue member functions.
Definition at line 143 of file Thread.hh.
jmp_buf Nucleo::Thread::m_context |
|
protected |
uint32_t Nucleo::Thread::m_expires |
|
protected |
Delay time expires; should not run for more than 2**32 seconds.
Definition at line 133 of file Thread.hh.
Double linked list pointers.
Definition at line 93 of file Linkage.hh.
const size_t Nucleo::Thread::MAIN_STACK_MAX = 64 |
|
staticprotected |
Size of main thread stack.
Definition at line 115 of file Thread.hh.
Main thread and thread queue head.
Definition at line 121 of file Thread.hh.
Top of stack allocation.
Definition at line 127 of file Thread.hh.
The documentation for this class was generated from the following files: