ADTF
Loading...
Searching...
No Matches
adtf::system::kernel_thread Class Reference

#include <kernel_thread.h>

Inherited by adtf::system::kernel_thread_looper.

Public Member Functions

 kernel_thread ()
 
 kernel_thread (const kernel_thread &)=delete
 
 kernel_thread (kernel_thread &&)
 
template<typename Callable, typename ... Args>
 kernel_thread (const adtf::services::IKernel::tSchedulingInfo &sScheduling, const char *strName, Callable &&pFunc, Args &&... args)
 
template<typename Callable, typename ... Args>
 kernel_thread (const char *strName, Callable &&pFunc, Args &&... args)
 
 ~kernel_thread ()
 
kernel_threadoperator= (kernel_thread &&oOther)
 
void Swap (kernel_thread &oOther)
 
bool Joinable () const
 
tResult Join (tTimeStamp nTimeout=-1)
 
tResult Detach ()
 
tResult SetScheduling (const adtf::services::IKernel::tSchedulingInfo &sScheduling)
 
tResult GetScheduling (adtf::services::IKernel::tSchedulingInfo &sScheduling) const
 
bool IsCurrentThread () const
 

Friends

class cKernelThreadHelperRunnable
 

Detailed Description

Class that manages a kernel thread. This can be use as a drop-in replacement for std::thread In contrast to std::thread, the destructor will join the thread if neccessary.

Constructor & Destructor Documentation

◆ kernel_thread() [1/4]

adtf::system::kernel_thread::kernel_thread ( )

Default constructor. Joinable = false.

◆ kernel_thread() [2/4]

adtf::system::kernel_thread::kernel_thread ( kernel_thread && )

Move constructor

◆ kernel_thread() [3/4]

template<typename Callable, typename ... Args>
adtf::system::kernel_thread::kernel_thread ( const adtf::services::IKernel::tSchedulingInfo & sScheduling,
const char * strName,
Callable && pFunc,
Args &&... args )
inline

Constructor that allows the definition of scheduling parameters.

◆ kernel_thread() [4/4]

template<typename Callable, typename ... Args>
adtf::system::kernel_thread::kernel_thread ( const char * strName,
Callable && pFunc,
Args &&... args )
inline

Constructor that creates a new thread.

◆ ~kernel_thread()

adtf::system::kernel_thread::~kernel_thread ( )

Destructor.

Member Function Documentation

◆ Detach()

tResult adtf::system::kernel_thread::Detach ( )

Detaches from the underlying kernel thread. All resources will be freed once the thread finishes.

Return values
ERR_INVALID_STATEThread is not joinable.

◆ GetScheduling()

tResult adtf::system::kernel_thread::GetScheduling ( adtf::services::IKernel::tSchedulingInfo & sScheduling) const

Retrieves the scheduling parameters of the thread.

Parameters
[in]sSchedulingThe scheduling parameters.
Returns
Standard result.

◆ IsCurrentThread()

bool adtf::system::kernel_thread::IsCurrentThread ( ) const

Check if the executing thread is managed by this thread object.

Returns
True if the executing thread is managed by this thread object, false otherwise.

◆ Join()

tResult adtf::system::kernel_thread::Join ( tTimeStamp nTimeout = -1)

Join the thread

Parameters
[in]nTimeoutDefines how long this call will block before returning (microseconds, -1 = infinite)
Return values
ERR_INVALID_STATEThread is not joinable.
ERR_TIMEOUTThe timeout has expired.

◆ Joinable()

bool adtf::system::kernel_thread::Joinable ( ) const

Whether or not the thread is joinable.

Returns
whether or not the thread is joinable.

◆ operator=()

kernel_thread & adtf::system::kernel_thread::operator= ( kernel_thread && oOther)

Move assignment operator.

Parameters
[in,out]oOtherThe object that should be moved.
Returns
A reference to this.

◆ SetScheduling()

tResult adtf::system::kernel_thread::SetScheduling ( const adtf::services::IKernel::tSchedulingInfo & sScheduling)

Changes the scheduling parameters of the thread.

Parameters
[in]sSchedulingThe new scheduling parameters.
Returns
Standard result.

◆ Swap()

void adtf::system::kernel_thread::Swap ( kernel_thread & oOther)

Swaps two threads

Parameters
[in,out]oOtherThe second thread.

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