Get the latest tech news

The missing cross-platform OS API for timers


ublished on 2025-02-02 Discussions: /r/programming Most serious programs will need to trigger some action at a delayed point in time, often repeatedly: set timeouts, clean up temporary files or entries in the database, send keep-alives, garbage-collect unused entities, etc. All while doing some work in the meantime.

Table of contents Most serious programs will need to trigger some action at a delayed point in time, often repeatedly: set timeouts, clean up temporary files or entries in the database, send keep-alives, garbage-collect unused entities, etc. Lately, I have found myself in need of doing just that, repeatedly sending a keep-alive over the network to many remote peers, in C. My program has an event loop, a la NodeJS or Redis. That means that using the venerable poll(2), we can wait on an array of very diverse things: sockets, files, signals, timers, processes, pipes, etc.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of timers

timers

Related news:

News photo

Rabbit’s r1 refines chats and timers, but its app-using ‘action model’ is still MIA