Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
kodi::tools::CTimer Class Reference

#include <Timer.h>

Inheritance diagram for kodi::tools::CTimer:
kodi::tools::CThread

Classes

class  ITimerCallback
 

Public Member Functions

 CTimer (kodi::tools::CTimer::ITimerCallback *callback)
 Class constructor to pass individual other class as callback.
 
 CTimer (std::function< void()> const &callback)
 Class constructor to pass individual function as callback.
 
 ~CTimer () override
 Class destructor.
 
bool Start (uint64_t timeout, bool interval=false)
 Start the timer by given time in milliseconds to make his call by arrive of them.
 
bool Stop (bool wait=false)
 Stop the timer if it is active.
 
bool Restart ()
 Restart timer complete by stop and restart his thread again.
 
void RestartAsync (uint64_t timeout)
 Restart the timer with new timeout without touch of his thread.
 
bool IsRunning () const
 Check timer is still active to wait for next call.
 
float GetElapsedSeconds () const
 Get elapsed time as floating point of timer as seconds.
 
float GetElapsedMilliseconds () const
 Get elapsed time as floating point of timer as milliseconds.
 

Protected Member Functions

void Process () override
 The function to be added by the addon as a child to carry out the process thread.
 
- Protected Member Functions inherited from kodi::tools::CThread
 CThread ()
 Class constructor.
 
virtual ~CThread ()
 Class destructor.
 
bool IsAutoDelete () const
 Check auto delete is enabled on this thread class.
 
bool IsCurrentThread () const
 Check caller is on this running thread.
 
bool IsRunning () const
 Check thread inside this class is running and active.
 
void CreateThread (bool autoDelete=false)
 Create a new thread defined by this class on child.
 
void StopThread (bool wait=true)
 Stop a running thread.
 
void Sleep (uint32_t milliseconds)
 Thread sleep with given amount of milliseconds.
 
bool Join (unsigned int milliseconds)
 The function returns when the thread execution has completed or timing is reached in milliseconds beforehand.
 

Additional Inherited Members

- Protected Attributes inherited from kodi::tools::CThread
std::atomic< boolm_threadStop
 Atomic bool to indicate thread is active.
 

Member Function Documentation

◆ Process()

void kodi::tools::CTimer::Process ( )
inlineoverrideprotectedvirtual

The function to be added by the addon as a child to carry out the process thread.

Use m_threadStop to check about active of thread and want stopped from external place.

Note
This function is necessary and must be implemented by the addon.

Implements kodi::tools::CThread.


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