c# - How to run n Task and keep the order of them -
i have method listen communication channel.
each package have put in concurrent queue , call task.run handle input.
the handle method create new task concurrentqueue trydequeue , on package ( take first queue input ).
how can keep order of task ? how can sure task1 handle package1 handled , finish task before task2 handle package2 , finish task ?
there can scenario task1 take package1 , task2 take package2 task2 finish running before task1 ... , must avoid.
how ?
Comments
Post a Comment