Skip to content

barisusakli/cpp-timeout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

cpp-timeout

A timeout class for c++

Usage

#include <iostream>
#include <chrono>
#include <thread>
#include "Timer.h"

int main() {
    bool running = true;
    
    Timer t1;
    t1.setTimeout([&]() {
        // triggered after 2000 milliseconds
        std::cout << "Executed timeout handler!";
        running = false;
    }, 2000);

    int frameTime = 16;
    while (running) {
        std::this_thread::sleep_for(std::chrono::milliseconds(frameTime));
        t1.update(frameTime);
    }
    std::cout << "Bye!";
}

About

A timeout class for c++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages