In my program I approaching text files in every iteration of loop to not lost any data from running. It is brutal uneffective and still I lost that data yesterday.
I have 2 Queues - "what have I done" and "what to do". After some time I need to end this application and remember these queues for next app run. I usually kill the applicatiaon with Ctrl+C.
Is there any way to run saving these Queues to files after app kill? Or how to End console application as a User correctly.
Is it possible to run piece of code atomically? I mean when I update some "Queue file" by removing first line of it I need to copy whole file to tmp than delete original file and than copy tmp file to original. But sometimes I hit Ctrl+C right after orig. file delete and I lost one queue.