Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. C/C++
  4. OS abstraction layers
  5. pw_thread
  6. OS abstraction layers
  7. Backends
  8. Eclipse ThreadX
  9. pw_thread_threadx
  10. pw::thread::threadx::Context Class Reference
pw::thread::threadx::Context Class Reference

Overview

Static thread context allocation including the TCB, an event group for joining if enabled, and an external statically allocated stack.

Example usage:

std::array<ULONG, kFooStackSizeWords> example_thread_stack;
pw::thread::threadx::Context example_thread_context(example_thread_stack);
void StartExampleThread() {
pw::thread::DetachedThread(
.set_name("example_thread")
.set_priority(kFooPriority)
.set_context(example_thread_context),
example_thread_function);
}
Definition: context.h:55
Definition: options.h:54
Inheritance diagram for pw::thread::threadx::Context:
pw::thread::threadx::ContextWithStack< kStackSizeWords >

Public Member Functions

 Context (span< ULONG > stack_span)
 
 Context (const Context &)=delete
 
Context & operator= (const Context &)=delete
 
TX_THREAD & tcb ()
 

Constructor & Destructor Documentation

◆ Context()

pw::thread::threadx::Context::Context ( span< ULONG >  stack_span)
inlineexplicit

Constructs a thread context using an externally allocated stack.

Precondition
stack_span.size() >= config::kMinimumStackSizeWords, and the backing storage must outlive this Context and any thread using it.
Parameters
[in]stack_spanPre-allocated stack storage in ULONG words.

Member Function Documentation

◆ tcb()

TX_THREAD & pw::thread::threadx::Context::tcb ( )
inline

Returns the underlying ThreadX TX_THREAD thread control block.

Intended for unit test and pw::Thread use only.

Returns
A reference to the underlying TX_THREAD TCB.

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