iceoryx_doc
1.0.1
|
This class periodically executes a callable specified by the template parameter. This can be a struct with a operator()()
overload, a cxx::function_ref<void()>
or std::fuction<void()>
.
More...
#include <periodic_task.hpp>
Public Member Functions | |
template<typename... Args> | |
PeriodicTask (const PeriodicTaskManualStart_t, const posix::ThreadName_t taskName, Args &&... args) noexcept | |
Creates a periodic task. The specified callable is stored but not executed. To run the task, void start(const units::Duration interval) must be called. More... | |
template<typename... Args> | |
PeriodicTask (const PeriodicTaskAutoStart_t, const units::Duration interval, const posix::ThreadName_t taskName, Args &&... args) noexcept | |
Creates a periodic task by spawning a thread. The specified callable is executed immediately on creation and then periodically after the interval duration. More... | |
~PeriodicTask () noexcept | |
Stops and joins the thread spawned by the constructor. More... | |
PeriodicTask (const PeriodicTask &)=delete | |
PeriodicTask (PeriodicTask &&)=delete | |
PeriodicTask & | operator= (const PeriodicTask &)=delete |
PeriodicTask & | operator= (PeriodicTask &&)=delete |
void | start (const units::Duration interval) noexcept |
Spawns a thread and immediately executes the callable specified with the constructor. The execution is repeated after the specified interval is passed. More... | |
void | stop () noexcept |
This stops the thread if it's running, otherwise does nothing. When this method returns, the thread is stopped. More... | |
bool | isActive () const noexcept |
This method check if a thread is spawned and running, potentially executing a task. More... | |
This class periodically executes a callable specified by the template parameter. This can be a struct with a operator()()
overload, a cxx::function_ref<void()>
or std::fuction<void()>
.
T | is a callable type without function parameters |
|
inlinenoexcept |
Creates a periodic task. The specified callable is stored but not executed. To run the task, void start(const units::Duration interval)
must be called.
Args | are variadic template parameter for which are forwarded to the underlying callable object |
[in] | PeriodicTaskManualStart_t | indicates that this ctor doesn't start the task; just pass PeriodicTaskManualStart as argument |
[in] | taskName | will be set as thread name |
[in] | args | are forwarded to the underlying callable object |
|
inlinenoexcept |
Creates a periodic task by spawning a thread. The specified callable is executed immediately on creation and then periodically after the interval duration.
Args | are variadic template parameter for which are forwarded to the underlying callable object |
[in] | PeriodicTaskAutoStart_t | indicates that this ctor starts the task; just pass PeriodicTaskAutoStart as argument |
[in] | interval | is the time the thread waits between two invocations of the callable |
[in] | taskName | will be set as thread name |
[in] | args | are forwarded to the underlying callable object |
|
inlinenoexcept |
Stops and joins the thread spawned by the constructor.
|
inlinenoexcept |
This method check if a thread is spawned and running, potentially executing a task.
|
inlinenoexcept |
Spawns a thread and immediately executes the callable specified with the constructor. The execution is repeated after the specified interval is passed.
[in] | interval | is the time the thread waits between two invocations of the callable |
|
inlinenoexcept |
This stops the thread if it's running, otherwise does nothing. When this method returns, the thread is stopped.