Asynchronous timer in event loop based process in C on Linux

The imaginary scenario:

There is an event loop (epoll) based processA which sometimes sends requests over network to another processB which runs on a different machine. ProcessA starts a timer asynchronously and waits for 10 seconds before giving up waiting for the response from processB. If the response from processB arrives within 10 seconds then the timer will be stopped.

The question is how would you implement this asynchronous timer in C on a Linux system?

Source: linux

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.