I don't think the title describes the situation exactly. I apologize for the poor description.
I'm trying to write a software system, in C++, that will have a heavy job (scanning the file system for a particular file or for infections, or just copying/moving a file from one place to another). This system has an interactive component which provides an opportunity for the user to pause and resume the operation. Given that we have a user interface, to achieve separation of concerns, I'm planning to have the job done on a separate thread of execution (within the same process) or a different process (if the interface and operation should be separated by process boundaries). I do not want the UI request handling logic creep into the job handler at all. Now, how should I design the system ? What (synchronization) primitives should I use here ?
I'm new to asynchronous programming. I understand that, the data structures to maintain (progress, current item in progress, checking integrity while resuming, part of job that is completed yet) will purely depend on the application. However, is there a general way to approach this problem ? I'm looking for a platform independent approach.
I assuming this is arguable and there may not be one correct answer, but any suggestions would help.