Sunday, March 3, 2019

How to manage a List from multiple threads?

I have a global List<T> object that is being populated by a long running task from one thread. In another thread, I need to periodically check this List (say every 30 seconds, for example) and if there are items, I need to take the first 10,000 (for example) and do something with this and remove those from the original list, all while the first thread is still writing to it.

Is this possible? Is there a threadsafe version of the List<T>?

How to manage a List from multiple threads? Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team