How to make values transfer between multiple threads
I have two threads:
Thread 1 is fetching XML from a web service in loop.
Thread 2 is parsing the XML fetched by thread 1 and showing it in the UI.
Please tell me what is the best way to pass XML data from thread 1 to thread 2 as it’s retrieved by thread 1?
Thread 1 is fetching the XML and then thread 2 consuming it.
To do so i have created a circular linked list and thread 1 puts its XML there in the linked list and thread 2 gets the XML for it and remove it from the list, and it’s working fine.
Please tell me if there is any other better approach than what I am using.
Looks like you need
The framework provides
with .NET 4.0. It should implement a queue between consumer and producer without the need of any manual synchronisation.