I've a dilemma reading a lot of documentation about timers, threadings and calling async process (cmd files), can't figure wich method and wich combination are the best for my scenario..
My scenario:
- Console application with .NET Framework 4.6
- I've a dictionary that has (as a key) an int that prefigures a specific second.
- The proccess begin on second zero (0)
- I've to call one (or more) process (different every time, with process start) when the seconds elapsed from the begin (step 3) are identical to the key of the dictionary (in step 2). This must be in the same second, so all calls must be in a different thread (I assume)
- This process will take more than a second to complete, and I've an async call that handle an event to take the response.
What I've got so far:
I'm running a System.Thread.Timer every second with a sample handler that call a process if there is any value for that second as key.
But I can't figure wich timer (Form, Timer, Thread) must I've to use in order to complain this in a better performance / way. I read about this but I think is a bit complex to understand it. This maybe, is my first question, a good implementation about this.
Also I called the process with Ohad Schneider answer from this: Is there any async equivalent of Process.Start?
But again, which combinatory of call async / or desync may I must use with the choosen kind of timer?
I'm a little lost here, sorry for my english and any comment, answer or suggest or edition to this post will be preciated. Thanks for your patience