Let me preface this by admitting that I am a novice - this is the first real project I am doing outside of a class.
I am running a single-threaded C++ simulation several hundred times (i.e. I have several hundred 'jobs'). I would like to be able to have a queue to which I add jobs (perhaps changing a parameter or two each time) and from which I can remove jobs as I please.
I have written a simple multithreaded program in the past, and was considering making each job a thread - but I thought of two problems with this approach:
- if I ctrl-C out of my program, then all threads stop, not just the one I am interested in. So if I want to stop one job but not the others, I don't have a way to do it.
- I cannot just add jobs, because I need to compile my entire program before I can run it.
I'd love to hear any suggestions as to how I can manage individual jobs - as far as I can see, multithreading may not be the way to go.