45 inline std::string
setTimeout(
long long delayMs, std::function<
void(
void )> callback, std::string name =
"" )
47 if ( !callback )
return "";
57 ss << *(
size_t* )(
char* )&
m_timeouts.back().callback;
66 return a.timer.getEnd() < b.timer.getEnd();
79 if ( evt.timer.isDone() ) {
85 } catch ( std::exception& e ) {
87 std::cout <<
"ERROR [" << evt.name <<
"] Timeout callback exception:\n\t" << e.what() << std::endl;
105 std::remove_if( m_timeouts.begin(), m_timeouts.end(), [&](
Timeout& evt ) ->
bool {
106 if ( evt.name == name ) {
bool cancelTimeout(std::string name)
Definition: timeout.h:100
std::string setTimeout(long long delayMs, std::function< void(void)> callback, std::string name="")
Definition: timeout.h:45
std::vector< Timeout > & getTimeouts()
Definition: timeout.h:119
void updateTimeouts()
Definition: timeout.h:74
std::vector< Timeout > m_timeouts
Definition: timeout.h:125
virtual void clear()
Definition: timer.cpp:27
virtual bool isSet()
Definition: timer.h:68
std::function< void(void)> callback
Definition: timeout.h:22
void clear()
Definition: timeout.h:24
std::string name
Definition: timeout.h:23
Timer timer
Definition: timeout.h:21