The Battle for Wesnoth  1.15.2+dev
Classes | Namespaces | Functions | Variables
timer.cpp File Reference
#include "gui/core/timer.hpp"
#include "events.hpp"
#include "gui/core/log.hpp"
#include <SDL2/SDL_timer.h>
#include <map>
#include <mutex>
Include dependency graph for timer.cpp:

Go to the source code of this file.

Classes

struct  gui2::timer
 
class  gui2::executor
 Helper to make removing a timer in a callback safe. More...
 

Namespaces

 gui2
 Generic file dialog.
 

Functions

static std::map< std::size_t, timer > & gui2::get_timers ()
 The active timers. More...
 
static uint32_t gui2::timer_callback (uint32_t, void *id)
 
std::size_t gui2::add_timer (const uint32_t interval, const std::function< void(std::size_t id)> &callback, const bool repeat=false)
 Adds a new timer. More...
 
bool gui2::remove_timer (const std::size_t id)
 Removes a timer. More...
 
bool gui2::execute_timer (const std::size_t id)
 Executes a timer. More...
 

Variables

static std::size_t gui2::next_timer_id = 0
 Ids for the timers. More...
 
static std::size_t gui2::executing_id = 0
 The id of the event being executed, 0 if none. More...
 
std::mutex gui2::timers_mutex
 
static bool gui2::executing_id_removed = false
 Did somebody try to remove the timer during its execution? More...