I am writing a program that controls some hardware via a serial port. The program will run various function based on user input. I need a way to queue these tasks and execute them synchronously on the same thread. I also need to be able to cancel them and track their status.
So I was thinking I could use tasks and chain them together using Task.ContinueWith. Will this be sufficient to force them on the same thread?
The other way I could do this is create a thread and run a continuous loop that checks a queue. The queue would hold delegates to the methods I need to run. This seems like reinventing the wheel though.