c# Queue calls to a method
Posted on 2015-01-07
I have a method (SendandGet) that sends and receives data from a System.IO.SerialPort.
I have several different areas in my program that call this method at intervals and by the user.
I'm looking for a way to queue the calls to the method so that I can then handle them in synchronized way and make sure that every call to the method is executed. Each call to the Method will either return data or timeout but the code must finish before the next call is made.
I would like to do this on a separate thread. Not having any luck with TPL (Tasks or Task.Factory) but I might not be using it right.