APM:Libraries
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Linux::Thread Class Reference

#include <Thread.h>

Inheritance diagram for Linux::Thread:
[legend]
Collaboration diagram for Linux::Thread:
[legend]

Classes

struct  stack_debug
 

Public Member Functions

 FUNCTOR_TYPEDEF (task_t, void)
 
 Thread (task_t t)
 
virtual ~Thread ()
 
bool start (const char *name, int policy, int prio)
 
bool is_current_thread ()
 
bool is_started () const
 
size_t get_stack_usage ()
 
bool set_stack_size (size_t stack_size)
 
virtual bool stop ()
 
bool join ()
 

Protected Member Functions

virtual bool _run ()
 
void _poison_stack ()
 

Static Protected Member Functions

static void * _run_trampoline (void *arg)
 

Protected Attributes

task_t _task
 
bool _started = false
 
bool _should_exit = false
 
pthread_t _ctx = 0
 
struct Linux::Thread::stack_debug _stack_debug
 
size_t _stack_size = 0
 

Detailed Description

Definition at line 30 of file Thread.h.

Constructor & Destructor Documentation

◆ Thread()

Linux::Thread::Thread ( task_t  t)
inline

Definition at line 34 of file Thread.h.

◆ ~Thread()

virtual Linux::Thread::~Thread ( )
inlinevirtual

Definition at line 36 of file Thread.h.

Here is the call graph for this function:

Member Function Documentation

◆ _poison_stack()

void Linux::Thread::_poison_stack ( )
protected

Definition at line 76 of file Thread.cpp.

Referenced by _run_trampoline(), and stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _run()

bool Linux::Thread::_run ( )
protectedvirtual

Reimplemented in Linux::PeriodicThread, Linux::Scheduler::SchedulerThread, and TestThread1.

Definition at line 46 of file Thread.cpp.

Referenced by _run_trampoline(), Linux::PeriodicThread::PeriodicThread(), and stop().

Here is the caller graph for this function:

◆ _run_trampoline()

void * Linux::Thread::_run_trampoline ( void *  arg)
staticprotected

Definition at line 37 of file Thread.cpp.

Referenced by start(), and stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FUNCTOR_TYPEDEF()

Linux::Thread::FUNCTOR_TYPEDEF ( task_t  ,
void   
)

◆ get_stack_usage()

size_t Linux::Thread::get_stack_usage ( )

Definition at line 126 of file Thread.cpp.

Referenced by Linux::Scheduler::_debug_stack(), and is_started().

Here is the caller graph for this function:

◆ is_current_thread()

bool Linux::Thread::is_current_thread ( )

Definition at line 203 of file Thread.cpp.

Referenced by ~Thread().

Here is the caller graph for this function:

◆ is_started()

bool Linux::Thread::is_started ( ) const
inline

Definition at line 42 of file Thread.h.

Referenced by Linux::SPIDevice::register_periodic_callback(), Linux::I2CDevice::register_periodic_callback(), Linux::PeriodicThread::stop(), and TEST().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ join()

bool Linux::Thread::join ( )

Definition at line 208 of file Thread.cpp.

Referenced by stop(), Linux::Scheduler::teardown(), and TEST().

Here is the caller graph for this function:

◆ set_stack_size()

bool Linux::Thread::set_stack_size ( size_t  stack_size)

Definition at line 236 of file Thread.cpp.

Referenced by is_started(), Linux::SPIDevice::register_periodic_callback(), and Linux::I2CDevice::register_periodic_callback().

Here is the caller graph for this function:

◆ start()

bool Linux::Thread::start ( const char *  name,
int  policy,
int  prio 
)

Definition at line 155 of file Thread.cpp.

Referenced by Linux::SPIDevice::register_periodic_callback(), Linux::I2CDevice::register_periodic_callback(), TEST(), and ~Thread().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop()

virtual bool Linux::Thread::stop ( )
inlinevirtual

Reimplemented in Linux::PeriodicThread, and Linux::PollerThread.

Definition at line 48 of file Thread.h.

Referenced by Linux::PeriodicThread::PeriodicThread().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _ctx

pthread_t Linux::Thread::_ctx = 0
protected

Definition at line 67 of file Thread.h.

Referenced by _poison_stack(), is_current_thread(), join(), and start().

◆ _should_exit

bool Linux::Thread::_should_exit = false
protected

Definition at line 66 of file Thread.h.

Referenced by Linux::PeriodicThread::_run(), and Linux::PeriodicThread::stop().

◆ _stack_debug

struct Linux::Thread::stack_debug Linux::Thread::_stack_debug
protected

Referenced by _poison_stack(), and get_stack_usage().

◆ _stack_size

size_t Linux::Thread::_stack_size = 0
protected

Definition at line 74 of file Thread.h.

Referenced by set_stack_size(), and start().

◆ _started

bool Linux::Thread::_started = false
protected

◆ _task

task_t Linux::Thread::_task
protected

Definition at line 64 of file Thread.h.

Referenced by _run(), and Linux::PeriodicThread::_run().


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