| 337 | } |
| 338 | |
| 339 | bool CancelTimer(HTimerWorld timer_world, HTimer handle) |
| 340 | { |
| 341 | Timer* timer = GetTimerFromHandle(timer_world, handle); |
| 342 | if (!timer) |
| 343 | { |
| 344 | return false; |
| 345 | } |
| 346 | if (timer->m_IsAlive == 0) |
| 347 | { |
| 348 | return false; |
| 349 | } |
| 350 | |
| 351 | timer->m_IsAlive = 0; |
| 352 | timer->m_Callback(timer_world, TIMER_EVENT_CANCELLED, timer->m_Handle, 0.f, timer->m_Owner, timer->m_UserData); |
| 353 | |
| 354 | if (timer_world->m_InUpdate == 0) |
| 355 | { |
| 356 | FreeTimer(timer_world, timer); |
| 357 | ++timer_world->m_Version; |
| 358 | } |
| 359 | |
| 360 | return true; |
| 361 | } |
| 362 | |
| 363 | uint32_t KillTimers(HTimerWorld timer_world, uintptr_t owner) |
| 364 | { |