pub struct PeriodicTaskGuard { /* private fields */ }Expand description
An instance which is returned by the SyncPeriodicTasks::add whuch guards the task and allows to control its state. If task is no longer needed the instance can be dropped and it will be removed from the system.
Implementations§
Source§impl PeriodicTaskGuard
impl PeriodicTaskGuard
Sourcepub fn reschedule_task(&self, ptt: PeriodicTaskTime) -> TimerResult<()>
pub fn reschedule_task(&self, ptt: PeriodicTaskTime) -> TimerResult<()>
Requests the task rescheduling - changine the timer time or mode.
The task is represented by the calling instance.
This function blocks the current thread for the maximum (in worst case) 5 seconds which is a timeout for feedback reception.
§Arguments
ptt- a new time to be set to timer.
§Returns
A Result as alias TimerResult is returned. In case if error is retuned, the operation should be considered as not completed correctly and the executor instance is poisoned i.e a bug happened.
The common errors may be retuned:
-
TimerErrorType::MpscTimeout - a feedback (with the result) reception timeout. Probably this is because the task executor is too busy.
-
TimerErrorType::TimerError - with the timer error.
-
TimerErrorType::NotFound - if instance was not found in the internal records. Should not happen. If appears, then probably this is a bug.
Sourcepub fn suspend_task(&self) -> TimerResult<()>
pub fn suspend_task(&self) -> TimerResult<()>
Requests to suspent the current task.
This function blocks the current thread for the maximum (in worst case) 5 seconds which is a timeout for feedback reception.
§Returns
A Result as alias TimerResult is returned.
In case if error is retuned, the operation should be considered as not completed correctly and the executor instance is poisoned i.e a bug happened.
The common errors may be retuned:
-
TimerErrorType::MpscTimeout - a feedback (with the result) reception timeout. Probably this is because the task executor is too busy.
-
TimerErrorType::TimerError - with the timer error.
Sourcepub fn resume_task(&self) -> TimerResult<()>
pub fn resume_task(&self) -> TimerResult<()>
Requests to resume the task from the suspend state.
This function blocks the current thread for the maximum (in worst case) 5 seconds which is a timeout for feedback reception.
§Returns
A Result as alias TimerResult is returned.
In case if error is retuned, the operation should be considered as not completed correctly and the executor instance is poisoned i.e a bug happened.
The common errors may be retuned:
-
TimerErrorType::MpscTimeout - a feedback (with the result) reception timeout. Probably this is because the task executor is too busy.
-
TimerErrorType::TimerError - with the timer error.