buildcache
buildcache copied to clipboard
Do certain tasks in a background daemon process
Certain tasks are better done in the background in a daemon process, such as:
- Compress and upload cache entries to a remote cache.
- House-keeping (prune old cache entries in the local cache).
Start a daemon process by starting the BuildCache exe with the argument --daemon, and make sure to pass the BuildCache configuration of the parent process to the child process.
One daemon is required for each unique BuildCache configuration (hash the configuration and BuildCache version?).
Start a new daemon if on isn't already running.
Let the daemon die after a time out period (e.g. 60s).
For Linux, see:
- https://github.com/pasce/daemon-skeleton-linux-c (https://stackoverflow.com/questions/17954432/creating-a-daemon-in-linux)
- https://www.thegeekstuff.com/2012/02/c-daemon-process/
For Windows, see:
- https://docs.microsoft.com/en-ca/windows/win32/services/the-complete-service-sample (?)
Most likely, the Windows alternative would be a service.
https://docs.microsoft.com/en-ca/windows/win32/services/the-complete-service-sample