Skip to content

aslrousta/timers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libtimers

libtimers is a native library to handle tons of timers.

Note: This is a work in progress.

Getting Started

The following code demonstrates an example which uses libtimers to print tick every second.

#include <stdio.h>
#include <timers.h>

void callback(void *arg) {
    printf("> tick\n");
    timers_start(1000 /* ms */, callback, NULL);
}

int main() {
    timers_init();
    timers_start(1000 /* ms */, callback, NULL);
    // ... do other time-consuming stuff
    timers_cleanup();
    return 0;
}

Now, you can build and run the program.

$ gcc -o ticker ticker.c -ltimers
$ ./ticker
> tick
> tick
> ...

To Do

  • Extend to above 1k timers Now supports up to 100k timers
  • Reduce memory footprint Now uses chunks to store timers
  • Support for Windows threads
  • Tickers (repeating timers)

License

libtimers is published under GPL-3.0 license.

About

C Library to Handle Tons of Timers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published