![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <EventLoopTimer.h>
Inheritance diagram for UE::EventLoop::TTimerManager< Traits >:Public Types | |
| using | FStorageType = TManagedStorage< FTimerData, typename Traits::FStorageTraits > |
| using | FTimerHandle = typename FStorageType::FExternalHandle |
| using | FInternalHandle = typename FStorageType::FInternalHandle |
| using | FInternalHandleArryType = typename FStorageType::FInternalHandleArryType |
Public Member Functions | |
| void | Init () |
| void | Tick (FTimespan DeltaTime) |
| bool | GetNextTimeout (FTimespan &OutTimeout) const |
| uint32 | GetNumTimers () const |
| FTimerHandle | SetTimer (FTimerCallback &&Callback, FTimespan InRate, bool InbRepeat=false, TOptional< FTimespan > InFirstDelay=TOptional< FTimespan >()) |
| void | ClearTimer (FTimerHandle &InHandle, FOnTimerCleared &&OnTimerCleared=FOnTimerCleared()) |
| bool | HasPendingRepeatTimer () const |
Additional Inherited Members | |
Protected Member Functions inherited from FNoncopyable | |
| FNoncopyable () | |
| ~FNoncopyable () | |
Timer manager for posting timers to an event loop.
The event loop timer manager provides the guarantee that its timers will never fire early while only progressing its view of time based on the delta passed to its Tick method. To provide this guarantee, timers may fire later than requested which is by design.
Adding and removing timers are thread-safe, however the timer callback and clear callbacks will both be called from within the Tick method, which may be a different thread. It is up to the user to handle thread safety within their callbacks.
| using UE::EventLoop::TTimerManager< Traits >::FInternalHandle = typename FStorageType::FInternalHandle |
| using UE::EventLoop::TTimerManager< Traits >::FInternalHandleArryType = typename FStorageType::FInternalHandleArryType |
| using UE::EventLoop::TTimerManager< Traits >::FStorageType = TManagedStorage<FTimerData, typename Traits::FStorageTraits> |
| using UE::EventLoop::TTimerManager< Traits >::FTimerHandle = typename FStorageType::FExternalHandle |
|
inline |
Clears a previously set timer.
Thread safe.
| InHandle | The handle of the timer to clear. |
| OnTimerCleared | Callback to be fired when the timer has been removed. The callback will be fired within the Tick method which may be a different thread from which the timer clear was requested. |
|
inline |
Retrieve the remaining time since the last call to Tick before the next timer will fire.
NOT thread safe.
| OutTimeout | Time amount of time relative to TimerManagers' internal time until the next valid timer will run. |
|
inline |
Returns the total number of timers. Includes active timers and timers waiting to be rescheduled.
NOT thread safe.
|
inline |
Returns whether any timers are waiting to be rescheduled.
NOT thread safe.
|
inline |
Initialize the timer manager and its storage.
NOT thread safe.
|
inline |
Set a new timer. The timer callback will be triggered from within the call to Tick, which may occur on a different thread from the one which set the timer.
Thread safe.
| Callback | Callback to call when timer fires. |
| InRate | The amount of time between set and firing. |
| InbRepeat | true to keep firing at Rate intervals, false to fire only once. |
| InFirstDelay | The time for the first iteration of a looping timer. |
| void UE::EventLoop::TTimerManager< Traits >::Tick | ( | FTimespan | DeltaTime | ) |
Accumulate the timer managers elapsed time and fire timers which have elapsed.
NOT thread safe.
| DeltaTime | The amount of time which has elapsed since the last call to Tick. |