API Documentation
Loading...
Searching...
No Matches
BasicThread Class Reference

A class that allows user to use a function inline to execute something. More...

#include <BasicThread.h>

Inheritance diagram for BasicThread:
[legend]
Collaboration diagram for BasicThread:
[legend]

Public Member Functions

 BasicThread (const String &name, const bool &is_loop, const std::function< void()> &callback)
 
void run () override
 
- Public Member Functions inherited from Thread
void detach ()
 
void forceStop ()
 
bool isPrimaryThread () const
 
bool isRunning () const
 
void join ()
 
virtual void requestStopThread ()
 
void setIsPrimaryThread (bool is_primary_thread)
 
void setThreadName (const String &name)
 
virtual bool shouldExitThread () const
 
void start ()
 
virtual void stopThread ()
 
 Thread ()
 
 Thread (const String &name)
 
 Thread (const Thread &name)=delete
 
const StringthreadName () const
 
virtual ~Thread ()
 

Static Public Member Functions

static void splitThread (const std::function< void()> &callback_a, const std::function< void()> &callback_b)
 
static void splitThread (const String &split_name, const std::function< void()> &callback_a, const std::function< void()> &callback_b)
 
template<uint04 t_max_number_of_threads>
static std::enable_if< t_max_number_of_threads<=32, void >::type ThreadLoop (uint04 number_of_loops, const std::function< void(uint04 index)> &callback)
 
template<uint04 t_max_number_of_threads>
static void ThreadLoop (uint04 number_of_loops, volatile uint04 &loops_performed, const std::function< void(uint04 index)> &callback)
 
- Static Public Member Functions inherited from Thread
static ThreadCurrentThread ()
 
static String CurrentThreadName ()
 
static void ServiceVirtualThreads ()
 
static void SetCurrentThreadName (const String &name)
 
static void StopAllThreads ()
 

Protected Attributes

std::function< void()> m_function
 
- Protected Attributes inherited from Thread
volatile bool m_is_running = false
 
volatile bool m_is_single_run = true
 

Additional Inherited Members

- Protected Member Functions inherited from Thread
const std::thread & self ()
 
- Static Protected Member Functions inherited from Thread
static void _setThreadName (const String &name)
 
static uint08 GetThreadCount ()
 

Detailed Description

A class that allows user to use a function inline to execute something.


concurrently.

Constructor & Destructor Documentation

◆ BasicThread()

BasicThread ( const String & name,
const bool & is_loop,
const std::function< void()> & callback )
explicit

Member Function Documentation

◆ run()

void run ( )
inlineoverridevirtual

Reimplemented from Thread.

◆ splitThread() [1/2]

void splitThread ( const std::function< void()> & callback_a,
const std::function< void()> & callback_b )
static

◆ splitThread() [2/2]

void splitThread ( const String & split_name,
const std::function< void()> & callback_a,
const std::function< void()> & callback_b )
static

◆ ThreadLoop() [1/2]

template<uint04 t_max_number_of_threads>
static std::enable_if< t_max_number_of_threads<=32, void >::type ThreadLoop ( uint04 number_of_loops,
const std::function< void(uint04 index)> & callback )
inlinestatic

◆ ThreadLoop() [2/2]

template<uint04 t_max_number_of_threads>
static void ThreadLoop ( uint04 number_of_loops,
volatile uint04 & loops_performed,
const std::function< void(uint04 index)> & callback )
inlinestatic

Member Data Documentation

◆ m_function

std::function<void()> m_function
protected

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