I am instanting an object A in the main.
One of its method f consists in getting inputs from a database, computing some values and then updating (write) a database.
I want to call f every x minutes. Let's say f needs y seconds to process.
How can i do that safely for both linux and windows plateform? Of course if the process is killed outside it should not leave the database in an unknown state. Thanks