开发者

multiple move operations and data processes in work thread

main thread--> start workthread-->StartStage(get lis开发者_如何学Got of positions for data process) --> move to one position --> data sampling --> data collection-->data analysis------>data sampling

basically, work thread does the data sampling --> data collection-->data analysis------>data sampling loop for one positioin until press stop or target is obtained.

my questions:

After work thread finishs the loop for one positioin, it would end itself.

now how to make the work thread moves to the next position to do the data process loop after work thread finish one position work, would not end itself until data process for all the positions are done?

Thanks in advance!


  • Make a ConcurrentQueue<> with all the positions
  • At the end of a position let a workerthread Dequeue a new position from the ConcurrentQueue<> and process it. This can be a simple while loop.
  • If the Dequeue fails there are no more positions and the thread exits
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜