nsbaci 1.0
Loading...
Searching...
No Matches
nsbaci::services::runtime::Thread Class Reference

Represents a thread in the runtime service. More...

#include <thread.h>

Public Member Functions

nsbaci::types::ThreadID getId () const
 Gets the thread ID.
nsbaci::types::ThreadState getState () const
 Gets the current state of the thread.
void setState (nsbaci::types::ThreadState newState)
 Sets the state of the thread.
nsbaci::types::Priority getPriority () const
 Gets the priority of the thread.
void setPriority (nsbaci::types::Priority newPriority)
 Sets the priority of the thread.
void push (int32_t value)
 Push a value onto the thread's stack.
int32_t pop ()
 Pop a value from the thread's stack.
int32_t top () const
 Peek at the top of the stack without removing.
uint32_t getPC () const
 Get the program counter.
void setPC (uint32_t addr)
 Set the program counter.
void advancePC ()
 Increment the program counter.
uint32_t getBP () const
void setBP (uint32_t addr)
uint32_t getSP () const
void setSP (uint32_t addr)
void pushReturnAddress (uint32_t addr)
 Push return address onto call stack.
uint32_t popReturnAddress ()
 Pop return address from call stack.
bool callStackEmpty () const
 Check if call stack is empty.
void pushFrame (const std::vector< int32_t > &savedLocals)
 Push a frame with saved local variable values.
std::vector< int32_t > popFrame ()
 Pop a frame and get saved local variable values.
bool frameStackEmpty () const
 Check if frame stack is empty.

Detailed Description

Represents a thread in the runtime service.

Each thread has its own stack, program counter, and execution state.

Member Function Documentation

◆ getId()

ThreadID nsbaci::services::runtime::Thread::getId ( ) const

Gets the thread ID.

Returns
The unique identifier of this thread.

◆ getPriority()

Priority nsbaci::services::runtime::Thread::getPriority ( ) const

Gets the priority of the thread.

Returns
The current Priority level.

◆ getState()

ThreadState nsbaci::services::runtime::Thread::getState ( ) const

Gets the current state of the thread.

Returns
The current ThreadState.
Here is the caller graph for this function:

◆ popReturnAddress()

uint32_t nsbaci::services::runtime::Thread::popReturnAddress ( )
inline

Pop return address from call stack.

Returns
The return address, or 0 if stack is empty.
Here is the caller graph for this function:

◆ setPriority()

void nsbaci::services::runtime::Thread::setPriority ( nsbaci::types::Priority newPriority)

Sets the priority of the thread.

Parameters
newPriorityThe new priority level to set.

◆ setState()

void nsbaci::services::runtime::Thread::setState ( nsbaci::types::ThreadState newState)

Sets the state of the thread.

Parameters
newStateThe new state to set.
Here is the caller graph for this function:

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